MySQL remote connection to user instance

Source: Internet
Author: User
After MySql is installed, there is only one ROOT user with super management permissions, and ROOT restrictions can only be used on the local database. What if we want to remotely manage MySql? So the fact

After MySql is installed, there is only one ROOT user with super management permissions, and ROOT restrictions can only be used on the local database. What if we want to remotely manage MySql? So the fact

After MySql is installed, there is only one ROOT user with super management permissions, and ROOT restrictions can only be used on the local database. What if we want to remotely manage MySql? In fact, we need to add a Super User with super management permissions and remote access. There are two ways to achieve this in MySql ,, we will add a super permission management user admin as an example.

You can add new users by issuing the GRANT statement: first, log on to MySql with the ROOT user on the database machine (do not tell me how to log on ?), Then:

Mysql> grant all privileges on *. * TO admin @ localhost identified by 'something' with grant option;
Mysql> grant all privileges on *. * TO admin @ "%" identified by 'something' with grant option;


In the first sentence, an admin user is added to authorize access through a local machine (localhost) with the password "something ". The second sentence is to authorize the admin user to initiate access from any other host (wildcard % ).

You can also directly add the same user access information by issuing an INSERT statement:

Mysql> insert into user VALUES ('localhost', 'admin', PASSWORD ('something'), 'y ', 'y', 'y ')
Mysql> insert into user VALUES ('%', 'admin', PASSWORD ('something'), 'y ', 'y', 'y ')


Depending on your MySQL version, for the above, you may have to use a different number of 'y' values (versions earlier than 3.22.11 have fewer permission columns ).

Verification Method: Enter the mysql-h host name or IP address-u username-p password in the command line.

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.