β STEP-BY-STEP FIX (Hosting Provider Side)
π 1. Open Port 3306 in the Firewall
If using firewalld
(CentOS/RHEL):
sudo firewall-cmd --permanent --add-port=3306/tcp
sudo firewall-cmd --reload
If using ufw
(Ubuntu/Debian):
sudo ufw allow 3306/tcp
sudo ufw reload
π§ This opens port 3306 so external IPs can reach it.
βοΈ 2. Configure MySQL to Accept Remote Connections
Open my.cnf
or mysqld.cnf
:
sudo nano /etc/my.cnf # Common on CentOS
# or
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf # Common on Ubuntu
Find this line:
bind-address = 127.0.0.1
Change to:
bind-address = 0.0.0.0
π‘ This makes MySQL accept connections from all IPs, not just localhost.
Then restart MySQL:
# CentOS/RHEL
sudo systemctl restart mysqld
# Ubuntu/Debian
sudo systemctl restart mysql
π§βπ» 3. Make Sure the MySQL User Has Remote Access
In MySQL shell:
GRANT ALL PRIVILEGES ON tsgbsite_tsgb_db.* TO 'tsgbsite_tsgb_us'@'%' IDENTIFIED BY 'YAqmBg9UPB^T';
FLUSH PRIVILEGES;
π οΈ This allows the user to connect from any host.
π§ͺ 4. Test It Yourself
From your Node.js app or terminal:
mysql -h 103.163.246.85 -u tsgbsite_tsgb_us -p
# Enter password when prompted
If the connection succeeds, you're all set!
π Summary You Can Send to Hosting Support
π§ Ask your hosting provider to do these:
- Open port
3306
in the firewall (for incoming TCP).- Set MySQL
bind-address
to0.0.0.0
(not127.0.0.1
).- Restart MySQL service after the change.
- Ensure MySQL user has privileges from
%
(any host).
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.