Mysql 5.7 创建用户同时授权

.创建用户同时授权

 

mysql -u root -p 

CREATE USER ‘dev’@‘localhost'  IDENTIFIED BY ‘dev’; #本地登录 

CREATE USER ‘dev’@‘%’  IDENTIFIED BY ‘dev’; #远程登录 

quit 

mysql -utest -p #测试是否创建成功

 

mysql> grant all on *.* to ‘dev’@‘%’ identified by ‘dev’;

mysql> flush privileges;

 

 

连接远程数据库

 

mysql -h127.0.0.1 -udev -p

posted @ 2018-03-31 11:25  一个橙子~  阅读(295)  评论(0编辑  收藏  举报