当前位置:网站首页>Mysql database remote access permission settings
Mysql database remote access permission settings
2022-07-02 10:44:00 【Software testing Xiaobai】
MySQL Database remote access permission settings
For beginners , We installed mysql Local service , Then use some graphical tools to link . Generally, we can link successfully ; however 、 In a simulated real environment, our database cannot be directly installed on the local machine , Most of them are on cloud servers , In this case, our mysql Nor is it a roadside bus that waves and stops , You still offered ( Buy tickets first !); That is, your account is not allowed to log in remotely , Only in localhost Sign in , What do I do ?
Next, I will explain two simple methods 、 The simplest method is to log in with an administrator account , In this way, you can modify
Let's login first mysql
One 、 Change table ( Of course, we need to know where the watch is first , Applicable to the entire database )
• show databases;# Display all databases
• use mysql;# Use mysql database
• show tables;# To find the user surface
• select * from user;# View all the information in this table
We can clearly identify the corresponding host ; Users and user permissions
1、 Directly modifying
update user set host = '%' where user = 'root';# to update root The user's host access is any value
2、 Add specified users and specified permissions
insert into user(host,user) values('ip','user');# Add a user user Address ip Unauthorized user of ( When you can insert new user information , Incidentally, check the authority , There will be an alarm during execution , Because there are constraints in the table , Don't go into it )
Added successfully , But I don't have permission .
Two 、 to grant authorization
• Direct authorization (mysql8.0 The version will report an error , Grammatical segmentation )
grant all privileges on *.* to 'user'@'ip' identified by '123456';# The authorization to the host is ip Of user Open to users , All permissions of all databases and corresponding tables , And the password is set to 123456( Fast and simple )
• Direct authorization ( Change - For the new version )
create user ‘user’@‘ip’ identified by ‘123456’;# Create a host address that is ip Login password is 123456 Of user user
grant all privileges on *.* to 'user'@'ip';# Link to the previous step , Give him all authority
• Specify authorization
create user ‘mysql’@‘%’ identified by ‘123456’;# When creating a host address, the login password of any address is 123456 Of mysql user ( Whenever and wherever possible , Login anywhere )
grant select,create on myemployees.* to 'mysql'@'%';# Set up mysql Users only use myemployees Check of Library , Create permissions
flush privilege;# Refresh the data permission
in the light of mysql8.0 An error will be reported when operating above version and cannot be linked ;
8.0 Because of the change of password rules and syntax rules , So set it again
In the same case, execute the following statements in sequence
alter user ‘mysql’@‘%’ identified by ‘123456’ passwore expire never;# Modify encryption rules
alter user ‘mysql’@‘%’ identified by ‘123456’ mysql_native_password by '123456';# Reset the password again
flush privilege;# Refresh the data permission
Try to link it with tools !
welfare
边栏推荐
- Delivery mode design of Spartacus UI of SAP e-commerce cloud
- Nonlinear optimization: establishment of slam model
- 14. Code implementation of semaphore
- 快速做出原型
- 618再次霸榜的秘密何在?耐克最新财报给出答案
- How to get the password of cpolar?
- shell编程01_Shell基础
- 【Visual Studio】每次打开一个Unity3D的脚本,都会自动重新打开一个新的VS2017
- [unity3d] nested use layout group to make scroll view with dynamic sub object height
- [pit avoidance guide] pit encountered by unity3d project when accessing Tencent bugly tool
猜你喜欢
Retrofit's callback hell is really vulnerable in kotlin synergy mode!
Delivery mode design of Spartacus UI of SAP e-commerce cloud
使用Windbg静态分析dump文件(实战经验总结)
Operator-1初识Operator
对话吴纲:我为什么笃信“大国品牌”的崛起?
[Fantasy 4] the transformation from U3D to UE4
shell编程01_Shell基础
[Fantasy 4] introduction and use of UMG components (under update...)
Postman--使用
SAP Spartacus express checkout design
随机推荐
Merge ordered sequence
Internet News: Tencent conference application market was officially launched; Soul went to Hong Kong to submit the listing application
This article takes you to learn in detail what is fiber to home FTTH
SUS系统可用性量表
高考的意义是什么
转换YV12到RGB565图像转换,附YUV转RGB测试
js promise.all
Mongodb quickly get started with some simple operations of mongodb command line
[unity3d] production progress bar - make image have the functions of filled and sliced at the same time
简洁、快速、节约内存的Excel处理工具EasyExcel
Sus system availability scale
[visual studio] every time you open a script of unity3d, a new vs2017 will be automatically reopened
对话吴纲:我为什么笃信“大国品牌”的崛起?
"Matching" is true love, a new attitude for young people to make friends
从MediaRecord录像中读取H264参数
13.信号量临界区保护
2021-09-12
07 data import sqoop
02-taildir source
pytest框架实现前后置