Linux Platform mysql Open Remote Login

  • 2021-07-03 00:57:13
  • OfStack

The development process often encountered remote access to mysql problems, every time need to search, feeling too troublesome, here to record, but also convenient for me to consult later.

First, access the mysql of this machine (log in to the terminal with ssh and enter the following command):

mysql -uroot -p

After entering the password and logging in, enter the following statement:


use mysql;
grant all privileges on *.* to 'user'@'%' identified by 'password' with grant option;

Among them:

user is the user name

mysql defaults to root

password is the password set by itself

% denotes any host, or you can specify an ip address

This allows remote access to any 1 host.

Example:

grant all privileges on *.* to 'root'@'192.168.1.100' identified by '' with grant option;

That is, 192.168. 1.100 is allowed to log in as an root user without a password.

OK, that's all. I hope it will help you.


Related articles: