Many application hosted on a server. But database is not remotely accessible.
MySQL remotely enabled change on the mysql.cnf file.
MySQL Server Remote Connection
Allowing connection of remote MySQL server in 3 a steps:
1. Edit MySQL configuration file.
2. Configured firewall.
3. Connect to remotely MySQL panel.
Step-1 Edit on the MySQL Config File
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
This changed after you can accessible remotely.
Also you have changed on the MySQL user.
Step-2 Firewall in a allow MySQL 3306 port
First one check your firewall is enable or disabled. Then you can allow the MySQL port. Also dedicated server in a personal firewall. Then you have changed on that server firewall page.
sudo ufw status
sudo ufw allow from remote_ip_address to any port 3306
Step-3 Login on to the MySQL panel.
sudo mysql -u root -p
Then MySQL in create new test user and database.
Hostname in a replace localhost to %. you can percentage access to any remotely IP to access.
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
- Change Bind-Address IP
- current default IP is set to 127.0.0.1
- Change it 0.0.0.0
This changed after you can accessible remotely.
Also you have changed on the MySQL user.
Step-2 Firewall in a allow MySQL 3306 port
First one check your firewall is enable or disabled. Then you can allow the MySQL port. Also dedicated server in a personal firewall. Then you have changed on that server firewall page.
sudo ufw status
sudo ufw allow from remote_ip_address to any port 3306
Step-3 Login on to the MySQL panel.
sudo mysql -u root -p
Then MySQL in create new test user and database.
Hostname in a replace localhost to %. you can percentage access to any remotely IP to access.
ALTER USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY 'Password123#@!';
To grant remote user access to a user and database:
GRANT ALL ON test.* TO 'test1'@'%';
FLUSH PRIVILEGES;
Step-4 Restart MySQL Service
sudo systemctl restart mysql
To grant remote user access to a user and database:
GRANT ALL ON test.* TO 'test1'@'%';
FLUSH PRIVILEGES;
Step-4 Restart MySQL Service
sudo systemctl restart mysql
Now you can remotely access database. Also you can check MySQL workbench or Dbeaver application.
0 Comments