[Linux]How To Enable Remote Access For MariaDB

PrivateDonut

Account Closed
banned
Rep
3
0
0
Rep
3
Vouches
0
0
0
Vouches
0
Posts
533
Likes
444
Bits
2 YEARS
2 YEARS OF SERVICE
LEVEL 31 71 XP
Today I will show you how to enable remote access for your MariaDB server, and creating a user to login to remotely.

This tutorial is one of many for my planned linux tutorials and follows my other two related to setting up trinity core on Debian 11.

Step 1: Configuring MariaDB​

We will need to edit the MariaDB configuration file in order to allow the server to listen for remote connections. We can access the configuration file by typing the following command:

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Then you will need to scroll down until you find:

bind-address = 127.0.0.1
and change it to:
bind-address = 0.0.0.0

After you completed the edit, simply hit control+o followed by control+x to save and exit the file. We will now need to restart the MariaDB server to allow the changes to take affect.

sudo systemctl restart mariadb
Now let’s check to make sure the server is listening for port 3306 outside of just local host. Type the following command:

netstat -ant | grep 3306
If you see 0.0.0.0:3306, and it says listen then you are set to move onto the next step.


Screen-Shot-2023-01-08-at-11.46.19-PM-1024x59.png



Step 2: Creating A New User With Remote Access​

Now that we finished setting up our MariaDB to listen for remote connections, we will now connect to our MariaDB and create a new user with remote access enabled. If you have followed my previous tutorials, then mysql by default doesn’t have a password for local root user. So just hit enter when it ask for the password.

sudo mysql -u root -p

Screen-Shot-2023-01-08-at-11.57.49-PM-1024x350.png


Let’s create a new user account for remote access. To ensure security, please make sure to either restrict access to your IP address or choose a very strong password. Simply replace the username with the username you want and password with the password you want.
CREATE USER 'username'@'%' IDENTIFIED BY 'password';

Now that you have a new user for remote access, we will grant them access to the databases for your WoW Private Server.
GRANT ALL PRIVILEGES ON auth.* TO 'username'@'%' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON world.* TO 'username'@'%' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON characters.* TO 'username'@'%' WITH GRANT OPTION;

Remember to substitute your chosen username in the queries above where it says ‘username’. If you are using this tutorial for databases outside of WoW Emulation, please make sure to select the correct databases when granting permissions.

Finished:​

You have now enabled remote access to your database, which can be useful if you are not running your server locally. If you encounter any issues, please let me know and I will try my best to assist you.
 
Last edited:
Liked By 3 members :

3,392

1,271

9,555

428

Top