Use root from any host, password: youpassword (your root password) to connect to the MySQL server:
# mysql-u Root-proot
Mysql>grant all privileges in *.* to ' root ' @ '% ' identified by ' Youpassword ' with GRANT OPTION;
Allow the address 202.11.10.253 to use root, password dboomysql to connect all the MySQL database, pay Select,insert,update,delete permissions.
# mysql-u Root-proot
Grant Select,insert,update,delete on *.* to root@ "202.11.10.253" identified by "Dboomysql";
Allow the address 202.11.10.253 to use root, password dboomysql to connect all the MySQL database, pay all the permissions.
# mysql-u Root-proot
Grant all on *.* to root@ "202.11.10.253" identified by "Dboomysql"
When you are done, remember to refresh the permissions by performing the following commands
FLUSH Privileges
Now look at the login method
The code is as follows |
Copy Code |
Mysql-u root-pvmwaremysql>use MySQL; Mysql>update User Set host = '% ' where user = ' root '; Mysql>select host, user from user; |
Running on a MySQL-installed machine:
1, d:mysqlbin>mysql-h localhost-u root
This should allow access to the MySQL server
2, mysql>grant all privileges in *.* to ' root ' @ '% ' with GRANT OPTION
Give any host access to data
3, Mysql>flush privileges
Change takes effect
4, Mysql>exit
Exit MySQL Server
This allows you to log in as root on any other host.
Connecting to MySQL on a remote host
Assume the IP of the remote host is: 110.110.110.110, username is root, password is abcd123. Type the following command:
mysql-h110.110.110.110-uroot-pabcd123//Remote Login
(Note: U and root can be without spaces, others are the same)
3, exit MySQL command: Exit (enter)