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.