Yes! it is possible. For this you have to allow remote access from your control panel, by adding your IP to the access hosts in mysql screen there. If you do not have a fix IP at your end you can use % as wild card and allow remote access from anywhere.
Then for remote connection you have to use the server IP or your domain IP or domain name instead of localhost in your script/program.
For example, to connect remotely via mysql command line utility:
mysql -h x.x.x.x -u USERNAME -p DATABASE
(where x.x.x.x is your server ip, USERNAME is the db user, and DATABASE is the database name)
NOTE: Whenever an IP/Host is added or removed from the Access Host field, the privileges need to be reassigned to the database user on that database otherwise it will produce Access Denied error.
Can I connect remotely to MySQL database? Print
- 3
Was this answer helpful?
Related Articles
What is MySQL?
MySQL is a very robust database server. It is often used to deliver dynamic content to sites such...
How do I connect to and use MySQL?
To create and connect to a database in cPanel, you can follow these steps:
1. Log in to your...
How can I backup and restore my MySQL databases?
There are two main ways to back up or restore a MySQL database on our servers: via SSH or the...
How do I create/delete/edit my databases and users?
All administration of your MySQL databases and users can be done through our convenient web based...
Can I import csv files using Load Data Infile?
This feature is not supported by cpanel but you can ask support to add File_priv to your db user...