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

Workaround when remote cannot connect to mysql and there is an error

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

The main content of this article is to explain "the solution to which you can't connect to mysql remotely and there is an error". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn the "remote can not connect to mysql and there is an error solution" bar!

Authorization law.

For example, if you want myuser to connect to the mysql server from any host using mypassword.

GRANT ALL PRIVILEGES ON *. * TO 'myuser'@'%' IDENTIFIED BY' mypassword' WITH GRANT OPTION

FLUSH PRIVILEGES

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 'myuser'@'192.168.1.3' IDENTIFIED BY' mypassword' WITH GRANT OPTION

FLUSH PRIVILEGES

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

GRANT ALL PRIVILEGES ON dk.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY' mypassword' WITH GRANT OPTION

FLUSH PRIVILEGES

The first method I used, at first, I found that it didn't work. I looked it up on the Internet and executed one less statement > FLUSH RIVILEGES to make the change effective. 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 'root'@'%' WITH GRANT OPTION / / Grant any host the right 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, I believe that you can not connect to the mysql remotely and have a deeper understanding of the wrong solution. You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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: 0

*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