心血来潮创建一个新用户,结果。。。步步艰难啊,好在最后成功,把我出现的问题和解决方案抛出来,希望大家顺顺利利创建成功┗|`O′|┛ 嗷~~
我出现的错误主要有这三种:
1、ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'indentified by '1998'' at line 1
2、ERROR 1396 (HY000): Operation CREATE USER failed for 'gaohan1'@'localhost'
3、ERROR 1410 (42000): You are not allowed to create a user with GRANT
解决办法:
1、找到mysql安装目录下的bin文件夹
2.cmd转到该目录下
C:Program FilesMySQLMySQL Server 8.0in>
3、登录:(输入密码)
C:Program FilesMySQLMySQL Server 8.0in>mysql -uroot -p
Enter password: ********
4、开始创建用户,并授予权限
mysql> use mysql; Database changed mysql> delete from user where user='gao'; #用常规方式删除一遍,防止之前建立了隐藏用户导致的无法创建成功 Query OK, 1 row affected (0.30 sec) mysql> flush privileges; Query OK, 0 rows affected (0.04 sec) mysql> create user gao@localhost identified by '1998';#开始创建用户 Query OK, 0 rows affected (0.09 sec) mysql> flush privileges;#刷新权利 Query OK, 0 rows affected (0.04 sec) mysql> quit Bye
5、退出并重新登录即可