Home  >  Article  >  Database  >  What to do if mysql fails to add user

What to do if mysql fails to add user

coldplay.xixi
coldplay.xixiOriginal
2020-11-03 11:12:123619browse

The solution to mysql failure to add users: first find the bin folder in the mysql installation directory; then go to the directory with cmd and log in; then start creating users and grant permissions; finally log out and log in again. Can.

What to do if mysql fails to add user

Solution to mysql failure to add user:

1. Find the bin folder in the mysql installation directory

2. Go to the directory with cmd

C:\Program Files\MySQL\MySQL Server 8.0\bin>

3. Log in: (enter password)

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -uroot -p
Enter password: ********

4. Start creating users and grant permissions

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. Just log out and log in again

More related free learning recommendations:mysql tutorial(Video )

The above is the detailed content of What to do if mysql fails to add user. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn