How to Access Your MySQL Database Remotely in SiteGround
MySQL is nothing but a freely available open source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL). It was launched on 23 May 1995 almost 21 years ago and in 2013 it was the world's second most widely used RDBMS, and the most widely used open-source client–server model RDBMS.
SQL is the most popular language for adding, accessing and managing content in a database. It is most noted for its quick processing, proven reliability, ease and flexibility of use. MySQL is an essential part of almost every open source PHP application. Good examples for PHP/MySQL-based scripts are PHP and Joomla. But by default, MySQL database server remote access is usually disabled for security reasons. However, sometimes you need to provide the remote access to database server from home or from the web server.
When MySQL is enabled for remote access, it has negative impacts on the server and its users, for example:
- External brute force attacks.
- Some customers might use the server as their main database server and point multiple external sites to the server.
- If your database users were somehow compromised, external attackers will be able to access your database.
Must Read:How To Start A Successful Blog
This post will explain how to safely setup a user account and access a MySQL Database Remotely in SiteGround.
Let us now focus on the source of problems that might be causing from accessing your MySQL Database remotely in SiteGround. If you have problems accessing your database at your web hosting account remotely please make sure of the following:
- Make sure that you are using the correct MySQL hostname – it should be yourdomain.com or your server's name;
- Secondly, you are using the correct MySQL database / username / password.
- You can actually go through SiteGround Tutorials to get more information on how to create them.
- You should not forget to specify your MySQL username and database with the prefixyourusername_ in front of its given name.
- For example, your cPanel username isuser and you have named your database Joomla. In this case, make sure to refer to your database as user_joomla.
- You have allowed the remote host to access your database. This can be done from yourcPanel > Remote MySQL.
- Another thing to keep in mind is that you are connecting to the TCP port 3306.
A common mistake that people make today is trying to access the database using the main cPanel login. This is something that we often tend to ignore and leads to issues when we try to access the database. For those of you who do this, it must be noted that this will not work and you will have to use the MySQL user instead.
It is a common problem that people face today. If you are having problems accessing your MySQL databases remotely, ask your SiteGround for assistance. SiteGround provides the best MySQL Hosting and assists you with any MySQL issues you may have.
In SiteGround, you can allow access to MySQL databases from an external location by adding its domain name or IP address to the list of hosts that are allowed to access your databases remotely. Additionally, if you would like to manage your database using an application for remote database management, the IP address from which the connection is established should be added to the list of allowed hosts. SiteGround MySQL hosting allows remote database access with the following items assumed.
Use the following configuration settings for connecting to your database:
- Host name = (use the server IP address)
- Database name = (cpanelUsername_databaseName)
- Database username = (cpanelUsername_databaseUsername)
- Database password = (the password you entered for that database user)
- MySQL Connection Port = 3306
- TCP or UDP either is fine.
Getting your IP address:
You will need to know what the IP address you are connecting from. To find this you can contact your host or even check it online on various sites.
Granting access to a user from a remote host is fairly simple and can be accomplished by just a few steps.
- First, you will need to login locally to your MySQL server as theroot
- This will prompt you for your MySQL root password.
- Once you are logged into MySQL you need to issue the GRANT command that will enable access for your remote user.
- You will also need to change my_password with the password that you would like to use for future uses.
Enable Your Computer as an Access Host:
By default, all IPs are blocked for any user. This IPs must be added to an access list in order to access the server. So, you must always keep in mind that before connecting to MySQL from another computer, the connecting computer must be enabled as an Access Host. In order to add allowed hosts, you should access the tool via cPanel -> Remote MySQL.
Now comes the Host Field, in the Host field you should enter the desired domain name or IP address. Then Click on the Add host button. A confirmation message will inform that the host is successfully added. Next time you access Remote MySQL the newly added host will be listed under Access Hosts.
The above-mentioned steps work for all the plans under SiteGround Hosting except for the GoGeek plan. Since GoGeek plan works for more business oriented stuff, the level of security is pretty high on it. Therefore, it is important to know how to access MySQL remotely only for accounts hosted on GoGeek servers. In order to complete the PCI compliance requirements, the remote MySQL connection to the GoGeek servers' primary IP is blocked. Still, to establish a remote MySQL connection to a database hosted on a GoGeek server use the server's secondary IP. This additional IP will be listed in the corresponding Remote MySQL page. Alternatively, you can find it in the Customer Area.
When you log into your Customer Area, switch to the My Account section. Once you are in the My Account you can go the Manage option and get the steps for My SQL remote access.
Well, this pretty much sums up the post on how to remotely access MySQL Database on SiteGround. It is quite simple if you follow the steps mentioned here. Yet if you still face further issues, you can always contact the 24×7 SiteGround Customer support for help.
Meta Description: Check How to Access MySQL Database remotely in SiteGround and manage your MySQL easily.