当前位置:网站首页>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
边栏推荐
猜你喜欢
flink 提交程序
Flutter——Canvas自定义曲线图
Aiphacode is not a substitute for programmers, but a tool for developers
Blender体积雾
"Talking about podcasts" vol.352 the age of children: breaking the inner scroll, what can we do before high school?
2.hacking-lab脚本关[详细writeup]
【Visual Studio】每次打开一个Unity3D的脚本,都会自动重新打开一个新的VS2017
Shapiro Wilk normal analysis by SPSS
session-cookie与token
axis设备的rtsp setup头中的url不能带参
随机推荐
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
Merge ordered sequence
(五)APA场景搭建之挡位控制设置
js promise. all
【TS】1368- 秒懂 TypeScript 泛型工具类型!
Flink实时计算topN热榜
【虚幻4】从U3D到UE4的转型之路
【Lua】常见知识点汇总(包含常见面试考点)
Post disaster reconstruction -- Floyd thought
Solution of mysql8 forgetting password file in Windows Environment
Mongodb quickly get started with some simple operations of mongodb command line
The nanny level tutorial of flutter environment configuration makes the doctor green to the end
[Fantasy 4] the transformation from U3D to UE4
传输优化抽象
MongoDB-快速上手MongoDB命令行的一些简单操作
What are the popular frameworks for swoole in 2022?
《MySQL 8 DBA基础教程》简介
stm32和電機開發(上比特系統)
Aiphacode is not a substitute for programmers, but a tool for developers
Solutions to a series of problems in sqoop job creation