Remote Database MariaDB di Debian12

nano /etc/mysql/my.cnf

atau

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

Change the value of the bind-address from 127.0.0.1 to 0.0.0.0 so that MariaDB server accepts connections on all host IPv4 interfaces.

bind-address = 0.0.0.0

sudo systemctl restart mariadb

netstat -ant | grep 3306

Configure Firewall

sudo ufw allow from 208.117.84.50 to any port 3306

sudo ufw allow 3306

sudo ufw reload

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN

mysql -u root -p

MariaDB [(none)]> CREATE DATABASE wpdb;
MariaDB [(none)]> CREATE USER ‘wpuser’@’localhost’ IDENTIFIED BY ‘password’;

MariaDB [(none)]> GRANT ALL ON wpdb.* to ‘wpuser’@’208.117.84.50’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

MariaDB [(none)]> GRANT ALL ON . to ‘wpuser’@’208.117.84.50’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;

MariaDB [(none)]> GRANT ALL ON wpdb.* to ‘wpuser’@’%’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;

MariaDB [(none)]> GRANT ALL ON wpdb.* to ‘wpuser’@’208.117.84.%’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;.

https://webdock.io/en/docs/how-guides/database-guides/how-enable-remote-access-your-mariadbmysql-database

Leave a Reply

Your email address will not be published. Required fields are marked *