mysql创建新用户步骤及常见问题

mysql创建新用户步骤

1.创建用户

CREATE USER 'ying'@'%' identified by '123456';

2.赋予用户权限

GRANT ALL ON *.* TO 'ying'@'%' WITH GRANT OPTION;

3.刷新权限

flush PRIVILEGES;

4.查询用户

SELECT user,host,Password from mysql.`user` WHERE user='ying';

此处已经创建新用户完成!!!✌️✌️✌️

常见问题

问题一:后台登录mysql失败,提示‘ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)’,如下:
在这里插入图片描述
1.重置localhhost用户的密码信息,并刷新权限

UPDATE mysql.`user` SET Password=Password('123456') WHERE `User`='root' AND Host='localhost';
 grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush PRIVILEGES

2.重新登录成功
在这里插入图片描述

发布了1 篇原创文章 · 获赞 1 · 访问量 69

猜你喜欢

转载自blog.csdn.net/Loyalty_Hello/article/details/103958144