首页 > 数据库技术 > 详细

MySQL创建新用户以及ERROR 1396 (HY000)问题解决

时间:2019-04-11 15:51:49      阅读:174      评论:0      收藏:0      [点我收藏+]

 登 录mysql

 mysql -u root -p

技术分享图片

创建允许本地 IP访问localhost的Mysql数据库时出错

 create user ‘lijing‘@‘localhost‘ identified by ‘147258369‘;

ERROR 1396 (HY000): Operation CREATE USER failed for ‘lijing‘@‘localhost‘

 出错原因:

Assume the user is there, so drop the user
After deleting the user, there is need to flush the mysql privileges
Now create the user.

以下解决办法:

创建允许本地 IP访问localhost的Mysql数据库:

 drop user ‘lijing‘@‘localhost‘;

 flush privileges;刷新系统权限表)

 create user ‘lijing‘@‘localhost‘ identified by ‘147258369‘;

技术分享图片

创建允许外网IP访问数据库lijing,本命令包含上面的命令,是所有的IP都可以访问该数据库

create user ‘lijing‘@‘%‘ identified by ‘147258369‘;258369‘;

技术分享图片

 创建成功后查询创建的用户是否成功

 select host,user,authentication_string from mysql.user;

技术分享图片

创建一个新的数据库,并使用show databases命令查看数据库是否创建OK

 create database lijingdb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

show databases;
技术分享图片

 

 

MySQL创建新用户以及ERROR 1396 (HY000)问题解决

原文:https://www.cnblogs.com/lj520fj/p/10641602.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!