• 微信公众号:美女很有趣。 工作之余,放松一下,关注即送10G+美女照片!

mysql通过特定的用户名和密码来远程授权数据库访问

开发技术 开发技术 3小时前 1次浏览

1、创建数据库用户:
create user ‘yw’@’%’ identified by ‘yw0921@#$’;

2、授权数据库访问:

 

登录MySQL

mysql>grant all privileges on db_name.db_table to ‘user_name’@’remote_address’ identified by ‘password’ with grant option;

名词解释:

db_name:MySQL服务器上的数据库

db_table:MySQL服务器上的数据表名

user_name:远程主机的登录用户名

remote_address:远程主机IP地址

password:远程主机的登录密码

GRANT ALL PRIVILEGES ON *.* TO ‘root’@’121.19.130.323’ IDENTIFIED BY ‘yw0921@#$’ WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON *.* TO ‘root’@’121.19.130.324’ IDENTIFIED BY ‘yw0921@#$’ WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON *.* TO ‘root’@’121.19.130.325’ IDENTIFIED BY ‘yw0921@#$’ WITH GRANT OPTION;

 

3、刷新授权:
FLUSH PRIVILEGES;

备注:

最后一步至关重要,不刷新这样就不会生效


程序员灯塔
转载请注明原文链接:mysql通过特定的用户名和密码来远程授权数据库访问
喜欢 (0)