本地连接CentOS云服务器的Mysql数据库
2017-03-29 本文已影响393人
Liumouren
1.首先在CentOS端进入数据库
mysql -u root -p"youpassword"
2.进行授权操作
GRANT ALL PRIVILEGES ON 数据库名.表名 TO 'root'@'IP地址' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
- 如果想让root用户只能在指定IP下才能登陆,如111.111.111.111,即
GRANT ALL PRIVILEGES ON 数据库名.表名 TO 'root'@'111.111.111.111' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
- 如果想让root用户只能在任何IP下都能登陆,将IP地址替换为%,即
GRANT ALL PRIVILEGES ON 数据库名.表名 TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
- 如果想给所有数据库的所有表的所有操作权限均授权给root这个用户,那么数据库名和表名均为*,即
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
3.重载授权表完成
FLUSH PRIVILEGES;