【记录工作遇到的问题】mysql授权问题

use mysql;

GRANT USAGE ON *.* TO ‘user_name‘@‘localhost‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;//授权user_name用户以密码123456访问数据库

GRANT SELECT,INSERT,UPDATE,DELETE ON db_name.* TO ‘user_name‘@‘localhost‘ IDENTIFIED BY ‘123456‘;//授权user_name用户访问db_name数据库的所有表.访问权限[SELECT,INSERT,UPDATE,DELETE]

FLUSH PRIVILEGES;//必须有

==突然领导说我要访问你的数据.然后悲剧了,如何支持远程连接呢?== 把localhost换成%.  localhost表示只能本地访问

use mysql;

GRANT USAGE ON *.* TO ‘user_name‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;

GRANT SELECT,INSERT,UPDATE,DELETE ON db_name.* TO ‘user_name‘@‘%‘ IDENTIFIED BY ‘123456‘;

==妹的,还是访问不了,注意关闭你的防火墙==

【记录工作遇到的问题】mysql授权问题

上一篇:Warning: Skipping the data of table mysql.event. Specify the --events option explicitly


下一篇:oracle long类型转换成varchar2