Sitemap
Rahmat Aulia

Rahmat Aulia

Tech Enthusiast. http://rahmataulia.my.id

Allow Remote Access MySQL in Debian 11

Oct 29, 2024
Press enter or click to view image in full size
Photo by Joshua Sortino on Unsplash

Before start, confirm MySQL is installed in your server. If installed, you can follow this step. First move to MySQL directory, then open mysqld.cnf file.

cd /etc/mysql/mysql.conf.d

Open mysqld.cnf file with nano/vim.

nano mysqld.cnf

search bind-address config, then replace with 0.0.0.0. Thats mean allow connection to MySQL service from anywhere.

bind-address = 0.0.0.0

then restart mysql service.

systemctl restart mysql

Create User

Get Rahmat Aulia’s stories in your inbox

Join Medium for free to get updates from this writer.

The best practice, you should create new user than using root for remote access.

CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Check Connection

So, check the connection between your host to server/local. If success you can using the user you have created.

--

--