1

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
1
  • /etc/mysql/my.cnf.dpkg-new: This file is not used. You need to rename it to have simply the .cnf extension, or presumably, there is already a file with that name. dpkg-new is created by the package manager when it has updates to the .cnf file, but won't do it because that file has been manually modified.
    – dbdemon
    Aug 6, 2022 at 11:50

1 Answer 1

0

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.

1
  • 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, 2020 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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