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 can not connect to the database remotely under ubuntu

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article introduces the relevant knowledge of "how to solve the problem that mysql can not connect to the database remotely under ubuntu". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The MySQL that comes with Ubuntu10.04 executes the

Root@ubuntu:~#sudo apt-get install mysql

After installing mysql-server

Start mysql

Root@ubuntu:~#/etc/init.d/mysql start

You can connect locally to the database.

Root@ubuntu:~#mysql-uroot-p

Remote access is set:

Mysql > grant all PRIVILEGES on *. * to admin@'%' identified by '123456'

Query OK, 0 rows affected (0.04 sec)

Mysql > use information_schema

Mysql > select * from user_privileges

The result of the query is as follows: admin'@%, indicates that mysql has authorized remote connections.

If you access the Ubuntu below, you cannot connect, but the apache installed on the Ubuntu can be accessed.

After adding port 3306 with iptalbes, it is also inaccessible.

Root@ubuntu:~# iptables-An INPUT-p tcp-dport 3306-j ACCEPT

View Mysql network connections on Ubuntu:

Root@ubuntu:~# netstat-an | grep 3306

Tcp 0 0 127.0.0.1 3306 0.0.0.0 * LISTEN

The local port is also listening

Root@ubuntu:~# ufw status

Firewall not loaded

Local firewall is not turned on

Later, a solution was found online:

Check / etc//my.cnf found bind-address and found that the configuration is 127.0.0.1 (bind-address=127.0.0.1), directly changed to bind-address=192.168.0.xxx (native ip), and then check that port 3306 is open, ok, and can connect normally.

"how to solve the problem that mysql can not connect to the database remotely under ubuntu" is introduced here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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