Scenario: I run the Centos,mysql in the virtual machine under the Mac terminal with SSH operation in CentOS
MySQL -u root -p
After logging in to MySQL with Root
Use
Grant All Privileges on DB1. * to [Email protected] ' % ' by ' User1 ' with Grant option;
The user named User1 (the password is User1,identified by followed by a password) to all hosts logged on (% refers to any host ) grants the operations database DB1 all data tables ( Db1.* refers to all the permissions DB1 all data tables .
At this time
Select * from MySQL. user \g;
Find User1 permissions or N, that is, the above grant operation is invalid, why?
Reason:
At this time under MySQL root login, execute show grants;
Grant All Privileges on *. * to ' Root '@'localhost' xxxxxxxxxxxx
For the root user to log on to the local host, and then I was in the Mac terminal SSH operation in the virtual machine MySQL, the root user of course no ownership.
Workaround: Go back to the virtual machine to log in to MySQL root operation.
In virtual machine MySQL, add:
Grant All Privileges on *. * to ' Root '@'%'by'root password ' withGrantoption;
Add and then use
Select * MySQL. user \g;
Found a row, the content is the user root, the host is%, has all permissions.
Then you can go back to Mac in MySQL login root.
If this does not work, you can use the following methods:
Open Mysqlworkbench on Mac (additional download required), log on to the virtual machine mysql with MySQL root user.
I am at this point the address of the virtual machine is 192.168.20.101 (make sure that the virtual machine's firewall is off or the MySQL port 3306 is turned on).
After logging in, select Users and privileges in the upper-left corner to add a user, and add User Rights administration roles the card.
Mysql grant all privileges on ... Do not take effect on the solution