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

登 录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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值