Add remote access to MySQL/MariaDB

 To allow remote access (from a web application or MySQL workbench) you need two things:

1) Allow access to the SQL-deamon. The configuration is placed in different locations with different names depending om MySQL-version. But here is where mine were: 

vi /etc/my.cnf

add a row in any place in the config:

bind-address = 0.0.0.0

After that is done, restart the deamon:

systemctl restart mysqld

2)  Need a user with allowed access from other machine. Edit the user-database as follows:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'MY.IP.ADDRESS' IDENTIFIED BY '<ROOT-password>' WITH GRANT OPTION;

Example (you can see that the UserDB have one more allowed  host in the bottom):

Kommentarer