Slackware HowTo

Configure secure remote MariaDB access on Slackware

Open MariaDB to the network only for hosts and privileges that are actually required.

1. When to use it

Use it when an application or reporting node must connect from another machine without turning the DB into an unnecessary risk.

MariaDB | remote access | GRANT | bind-address | firewall

2. Base setup

sed -i 's/^bind-address.*/bind-address=0.0.0.0/' /etc/my.cnf
mysql -e "CREATE USER 'report'@'192.168.1.%' IDENTIFIED BY 'StrongPass123';"
mysql -e "GRANT SELECT ON appdb.* TO 'report'@'192.168.1.%'; FLUSH PRIVILEGES;"
/etc/rc.d/rc.mysqld restart

Adjust host names, IPs, interfaces, paths, and versions to the real system before making the change persistent.

3. Quick verification

ss -lntp | grep 3306
mysql -e "SELECT user,host FROM mysql.user;"
mysql -e "SHOW GRANTS FOR 'report'@'192.168.1.%';"

Confirm that the output matches the expected state before considering the intervention complete.

4. Operational notes

Restricting hosts, privileges, and firewall is more important than bind-address alone: treat the database as a high-exposure service.

Quick checklist

[ ] Steps completed\n[ ] Config updated\n[ ] Tests executed\n[ ] Rollback ready\n[ ] Logs checked

Back to Linux HowTo