MariaDB can’t connect from remote host

mariadb

MariaDB [(none)]> show variables like '%skip_networking%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| skip_networking | OFF   |
+-----------------+-------+
1 row in set (0.00 sec)

When I try

mysql -uroot -p -h 192.168.0.30

I received this

ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.30' (111 "Connection refused")

In the file

 /etc/mysql/mariadb.conf.d/50-server.cnf

I have this:

bind-address            = 0.0.0.0
# skip-networking

I hope you can help me.

local connection works.

sudo netstat -ntlup | grep mysql
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      11580/mysqld

I see the "127.0.0.1:3306" but I don't know how can I change it.

Best Answer

Credits : https://stackoverflow.com/a/14779244/7499402

What is disabled by default is remote root access. If you want to enable that, run this SQL command locally:

 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
 FLUSH PRIVILEGES;

And then find the following line and comment it out in your my.cnf file, which usually lives on /etc/mysql/my.cnf on Unix/OSX systems. If it's a Windows system, you can find it in the MySQL installation directory, usually something like C:\Program Files\MySQL\MySQL Server 5.5\ and the filename will be my.ini.

Change line

 bind-address = 127.0.0.1

to

 #bind-address = 127.0.0.1

And restart the MySQL server for the changes to take effect.

Related Topic