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:
- 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 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:
- mysql>INSERT INTO user VALUES('localhost','admin',PASSWORD('something'), 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')
- 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.