MySQL Root remote login command

Source: Internet
Author: User
Tags flush mysql database

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.