-1

so, I've been away a bit from server administration, so maybe I am bit rusty. It's my first time with Debian 9 and MariaDB and that 'nice' thing just wont let me connect via TCP.

Out of the box Debian 9.3 with MariaDB on Digitalocean, I did try

#bind-address           = 127.0.0.1
bind-address = 0.0.0.0

both options above.

I can connect via socket

mysql -u root -p

but not via TCP

mysql -u root -p -h 172.0.0.1

it takes forever (1minute at least) and then gives me the following error message

ERROR 2003 (HY000): Can't connect to MySQL server on '172.0.0.1' (110 "Connection timed out")

I searched already a lot, (that's also by I use the 127... not localhost because localhost uses the socket) but nothing really helps. skip-networking does not exist anymore, log files look good

2018-02-24 18:36:50 140298638565952 [Note] Server socket created on IP: '::'.
2018-02-24 18:36:50 140298638565952 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.1.26-MariaDB-0+deb9u1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Debian 9.1

It does look like the TCP connection is turned of, but where?


add on, I tried to connect via telet to port 3306 and it is working.

telnet 127.0.0.1 3306 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. b 5.5.5-10.1.26-MariaDB-0+deb9u1q#Yt``Cl-? x8LTD6~;JAH%mysql_native_password


second add on

netstat -an | grep tcp | grep 3306

tcp6       0      0 :::3306                 :::*                    LISTEN

is that IPv6 only???

Chris
  • 129
  • 1
  • 2
  • 11
  • A socket listening on ":::3306"" listens on IPv4 and IPv6 simultaneously. Telnet shows that there are no issues with network and MariaDB configuration. Try checking with "strace": # apt install strace -y # strace mysql -u root -p -h 127.0.0.1 – Elvis Plesky Feb 24 '18 at 22:34

2 Answers2

0

0.0.0.0 binds to default interface (127.0.0.1)

According to the error message "Can't connect to MySQL server on '172.0.0.1'", you're trying to connect on 172.0.0.1 but not on 127.0.0.1

Georg Richter
  • 5,970
  • 2
  • 9
  • 15
0

ok, after some more digging, the whole thing is not a connection problem, it's a permissions problem.

OK  mysql -u root -p
NOK mysql -u root -p -h 127.0.0.1
OK  mysql -u mysqladmin -p -h 127.0.0.1

so I can connect via socket, just not via root.

given that I originally only wanted to test if the server is running correctly on a different port, I am fine with this.

I found some links which cover the root login via TCP, for someone landing here and needing to find a solution for root/TCP problem also.

MySQL root access from all hosts

https://www.digitalocean.com/community/questions/mariadb-enable-root-login-via-both-unix_socket-and-tcp

Chris
  • 129
  • 1
  • 2
  • 11