Mysql root User remote logon command

Source: Internet
Author: User

This article describes how to use the mysql root User remote logon command and various methods to start remote logon. For more information, see.

Use the root user on any host, password: youpassword (your root password) to connect to the mysql server:

# Mysql-u root-proot
Mysql> grant all privileges on *. * TO 'root' @ '%' identified by 'youpassword' with grant option;
Allow the address 202.11.10.253 to connect to all mysql databases with the root user and password dboomysql, and grant the select, insert, update, and 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 the root user and password dboomysql to connect to all mysql Databases and grant all permissions.

# Mysql-u root-proot

Grant all on *. * to root @ "202.11.10.253" Identified by "dboomysql"

After the operation, remember to execute the following command to refresh the permission.

FLUSH PRIVILEGES

Now let's look at the logon 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;


Run the following command on the machine where mysql is installed:
1. d: mysqlbin> mysql-h localhost-u root
// You can access the MySQL server.
2. mysql> grant all privileges on *. * TO 'root' @ '%' WITH GRANT OPTION
// Grant data access permissions to any host
3. mysql> FLUSH PRIVILEGES
// The modification takes effect.
4. mysql> EXIT
// Exit the MySQL server
In this way, you can log on to any other host as the root user.


Connect to MYSQL on the remote host

Assume that the IP address of the remote host is 110.110.110.110, the user name is root, and the password is abcd123. Enter the following command:

Mysql-h110.110.110.110-uroot-pabcd123 // remote Logon

(Note: you do not need to add spaces for u and root. The same applies to others)

3. exit MYSQL command: exit (Press 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.