Correctly add remote control user operations to the MySql database

Source: Internet
Author: User

The following article describes how to add a remote control user to the MySql database. After installing the MySql database, only the ROOT user with the super management permission exists, in addition, the ROOT limit 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 a new user by issuing a GRANT statement: first, log on to the MySql database with the ROOT user on the database machine. Do not tell me how to log on ?), Then:

 
 
  1. mysql>GRANT ALL PRIVILEGES ON *.* TO admin@localhost IDENTIFIED BY 'something' WITH GRANT OPTION;  
  2. 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 localhost on the local machine. The password is "something ". The second sentence is to authorize the admin user to initiate an access wildcard % from any other host ).

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

 
 
  1. mysql>INSERT INTO user VALUES('localhost','admin',PASSWORD('something'), 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')  
  2. mysql>INSERT INTO user VALUES('%','admin',PASSWORD('something'), 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')  

Depending on your MySQL database 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 ).

Note: If a firewall is installed, port 3306 must be allowed for access.
 



The above content is an introduction to adding remote control users to the MySql database. I hope you will have some gains.

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.