怎么给mysql添加用户名和密码
FXL
2020-08-26 10:53:583574浏览 · 0收藏 · 0评论
具体方法:
(推荐教程:MySQL教程)
1、打开命令提示符,进入到 mysql 的安装目录下
2、使用root用户登录数据库
E:\mysql-5.6.14-winx64\bin>mysql -uroot -p
3、创建用户
create user'用户名'@'localhost'identified by '密码';
4、给予权限 GRANT ALL ON *.* TO 'rsm'@'%';
grant all on *.* to 'jsyl'@'localhost'; grant all privileges on *.* to 'root'@'%' identified by 'root'; (%) 表示所有ip
执行完上述命令后用下面的命令刷新权限
flush privileges;
5、退出,检验,新用户重新登录
E:\mysql-5.6.14-winx64\bin>mysql -ujsyl -p Enter password: ********* Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 36
关注公众号,随时随地在线学习
FXL
认证0级讲师