Header Ads

How to configure access remote in MariaDB and MySQL

 How to configure access remote in MariaDB and MySQL

How to configure access remote in MariaDB and MySQL


Configure Remote Access to MySQL / MariaDB Databases in ubuntu 16.04, 18.04, 20.04 LTS

Config with MySQL:

sudo vim /etc/mysql/mysql.conf.d/mysql.cnf

Change 

bind-address =127.0.0.1

to

bind-address =0.0.0.0

Restart mysql services

sudo systemctl restart mysql.service

Config with MariaDB:

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

add line

bind-address =0.0.0.0

Restart mariadb services

sudo systemctl restart mariadb.service

Verify allows access to mysql with global

sudo netstat -anp | grep 3306

How to configure access remote in MariaDB and MySQL

Add global user with mysql query:

CREATE USER 'user'@'%' IDENTIFIED BY '123456';

GRANT ALL PRIVILEGES ON *.* TO 'user'@'%';

FLUSH PRIVILEGES;

Connect to server

mysql -h'Your-IP' -u'user' -p'123456' <Databases>

Thanks

No comments