I
I
imambek2020-05-28 15:30:54
linux
imambek, 2020-05-28 15:30:54

How to correctly set up mysql on the server for remote access?

Installed mysql-server, mysql-client, php-mysql/ on VDS
Changed bind-address to 0.0.0.0
Created user GRANT ALL PRIVILEGES ON db.* TO [email protected]'%' IDENTIFIED BY 'xxx';

But I can't remotely connect to the database. How to get remote access to the database on vds?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
1
101-s, 2020-05-28
@101-s

ports checked?
you can login mysql -u root -p
and see
show variables like 'port';
if you have iptables on the server then
iptables -A INPUT -p tcp --dport 3306 -j ACCEPT

O
Official account of the Timeweb team, 2020-05-28
@timeweb_team

Apparently, there is a problem with the firewall, or something else, because of which connections on port 3306 do not reach the server.
As part of the diagnostics, try temporarily disabling the firewall and trying to connect again. Also provide the output of a connection attempt from a remote server. What error is being thrown?
As a check for port availability, try scanning the delivery of udp packets to the server. To do this, on the server where you are trying to connect remotely, enter the packet capture command: tcpdump -i any port 3306. Then, on the server from which the remote connection is made, start scanning the port of the first server: nc -vnzu IP-address_of the first server 3306. Then on the first server in the console the output "tcpdump" should appear with the address of the second server, which will mean that the packets reach correctly and there should be no problems with a remote connection

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question