mysql 创建用户

CREATE USER 'root'@'192.168.1.%' IDENTIFIED BY 'root'; 

 


mysql 8.0 以上... 


ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

mysql 5.5 : 
 update user set password=password('123') where user='root' and host='localhost';
或  update user set password=password('123') where user='root' ;  


GRANT ALL privileges ON *.* TO 'root'@'192.168.1.%';
flush PRIVILEGES;

 修改密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';  

设置密码不过期
alter user 'root'@'localhost' password expire never;

如果是 Mysql 8.0 ,请将 三句话 分开来写!! 也就是 3 句话 不能在 同一个事务中执行!!!

CREATE USER 'root'@'192.168.0.%' IDENTIFIED BY 'root'; GRANT ALL privileges ON *.* TO 'root'@'192.168.1.%';flush PRIVILEGES;

 

删除用户

DROP user '123'@'%'

posted on 2017-09-14 11:19  正义的伙伴!  阅读(163)  评论(0编辑  收藏  举报

导航

//增加一段JS脚本,为目录生成使用