[Document of the institute of fire station building school] the mysql permission problem encountered during the separation of web and DB.
Run
Use mysql;
Select user, password, host from user;
There is an account that can be logged on without the user name and password. So you just need to get rid of this
Update user set user = 'root', host = '192. 192.% 'where user = "and host = 'localhost ';
Modify user permissions
Grant all on * to root@192.168.0. %;
Flush privileges;
From the local connection test, there is still only the test table, and there is no permission to create a database. Run the following command to query
Show grants root@192.168.0. %;
The following results are found:
Grant usage on *. * TO 'root' @ '2017. 192. %'
The result is obviously incorrect.
Log out as another ROOT user and run the following command.
Show grants for current_user ();
The result is as follows:
Grant all privileges on *. * TO 'root' @ 'localhost' WITH GRANT OPTION
You didn't find it. You still need to add with grant option later. You are welcome to continue your communication at the School of building a website in the fire !~