Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 257

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report