心血來潮創建一個新用戶,結果。。。步步艱難啊,好在最后成功,把我出現的問題和解決方案拋出來,希望大家順順利利創建成功┗|`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 Files\MySQL\MySQL Server 8.0\bin>
3、登錄:(輸入密碼)
C:\Program Files\MySQL\MySQL Server 8.0\bin>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、退出並重新登錄即可