Get the App
SLTechnology News&Howtos  ›  Database  › 

How to solve the problem that MySQL database is not allowed to access remotely

Shulou Source: shulou.com Published: 2022-05-31 18:01:01 09月25日 Update

This article mainly introduces "how to solve the problem that MySQL database is not allowed to access remotely". In daily operation, I believe many people have doubts about how to solve the problem that MySQL database is not allowed to access remotely. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubt of "how to solve the problem that MySQL database is not allowed to access remotely." Next, please follow the editor to study!

Solution:

1. Change the table method. It may be that your account is not allowed to log in remotely, only in localhost. At this time, as long as on the computer in localhost, after logging in to MySQL, change the "host" entry in the "user" table in the "MySQL" database from "localhost" to "%"

MySQL-u root-pvmwareMySQL > use MySQL

MySQL > update user set host ='% 'where user =' root'

MySQL > select host, user from user

2. Authorization law. For example, if you want myuser to connect to the MySQL server from any host using mypassword.

GRANT ALL PRIVILEGES ON *. * TO BY 'mypassword' WI

TH GRANT OPTION

If you want to allow the user myuser to connect to the MySQL server from the host with ip 192.168.1.6, and use mypassword as the password

GRANT ALL PRIVILEGES ON *. * TO BY

'mypassword' WITH GRANT OPTION

The first method I used found that it didn't work at first. I looked it up on the Internet and executed one less sentence, MySQL > FLUSH RIVILEGES.

Put the changes into effect. That's it.

Another method, but I haven't tried it myself. I can find it on csdn.net.

Run on the machine where MySQL is installed:

1. D:MySQL bin > MySQL-h localhost-u root

/ / this should allow access to the MySQL server

2. MySQL > GRANT ALL PRIVILEGES ON *. * TO GRANT OPTION

/ / Grant any host permission to access data

3. MySQL > FLUSH PRIVILEGES

/ / the modification takes effect

4. MySQL > EXIT

/ / exit the MySQL server

This allows you to log in as root on any other host.

At this point, the study on "how to solve the problem that MySQL database is not allowed to be accessed remotely" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Data database problem host method server learning service more help no practical next password article time machine permission theory user Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MariaDB Redmi NVidia OPPO Reno