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 -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.
port        = 3306
socket      = /var/run/mysqld/mysqld.sock

Ping is OK:

cmd> ping

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

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

Anyway, I fixed the problem via

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

where is the host machine IP.

Then connected via

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

Looks like working.

Still concerned some features face problems.

  • FLUSH PRIVILEGES isn't required for grant. Also better get used to creating users separately as the combined create user/ grant syntax is going away. Why are you concerted about exposure on your lan address?
    – danblack
    Aug 10 '20 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.