MySQL – Connecting MySQL Client to a MariaDB Server

mariadbMySQL

I am new to databases, so I might have done something very simple wrong.

I cannot connect to my Mariadb server via my mysql client. Is this possible at all?

cmd> mysql -h 192.168.0.17 -u root -P 3306

gives me an error:

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

On my host machine, I have mysql with version

cmd> mysql -V
mysql  Ver 14.14 Distrib 5.6.10, for Win64 (x86_64)

and on my VM, I have an ubuntu server

$ mysql -V
mysql  Ver 15.1 Distrib 10.3.23-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

and my config on VM:

$ cat /etc/mysql/my.cnf.dpkg-new | head -n 20 | tail -n 7
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port        = 3306
socket      = /var/run/mysqld/mysqld.sock

Ping is OK:

cmd> ping 192.168.0.17

Pinging 192.168.0.17 with 32 bytes of data:
Reply from 192.168.0.17: bytes=32 time<1ms TTL=64
Reply from 192.168.0.17: bytes=32 time<1ms TTL=64
Reply from 192.168.0.17: bytes=32 time<1ms TTL=64
Reply from 192.168.0.17: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.0.17:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

Best Answer

Anyway, I fixed the problem via

MariaDB [(none)]> Grant All Privileges ON *.* to 'remoteroot'@'192.168.0.15' Identified By '123456';
MariaDB [(none)]> FLUSH PRIVILEGES;

where 192.168.0.15 is the host machine IP.

Then connected via

cmd> mysql -h 192.168.0.17 -u remoteroot -P 3306 -p

Looks like working.

Still concerned some features face problems.