mysql database remote access setup method

  • 2020-05-06 11:50:19
  • OfStack

1, change the table method.

It may be that your account is not allowed to log in remotely, only in localhost. At this point, just login to mysql from the localhost computer and change the   host   entry in   mysql   database from localhost to es%
mysql  -u   root   pvmwaremysql> use   mysql;
mysql> update   user   set   host   =   '%'   where   user   =   'root';
mysql> select   host,   user   from   user;
2. Authorization. For example, if you want myuser to connect to mysql server from any host using mypassword.
GRANT   ALL   ON   *.*   TO   myuser'@'%'IDENTIFIED   BY mypassword  
* TH   GRANT   OPTION;
If you want to allow user myuser to connect to mysql server from ip's 192.168.1.6 host and use mypassword as the password
*   TO myuser'@'192.168.1.3'IDENTIFIED   BY
* 'mypassword'   WITH   GRANT   OPTION;
The first method I used, at first I found out that it didn't work, so I checked the Internet and executed one less statement   mysql> FLUSH   RIVILEGES
Make the change effective and
is ready
Another approach:

Run on the machine on which mysql is installed:
1, d: \ mysql \ bin \ > mysql   -h   localhost   -u   root
// this should allow access to MySQL server
2, mysql> GRANT   ALL   PRIVILEGES   ON   *.*   TO   'root'@'%'WITH   GRANT   OPTION
// give any host access to the data 3, mysql> FLUSH   PRIVILEGES
// the modification takes effect
4, mysql> EXIT
// quit MySQL server
This allows you to log in as root on any other host.

Related articles: