Steps to Share a MySQL Database in Cpanel

By | July 27, 2011

cPanel is one of the popular control panel. It allows webmaster to control a number of  key server features, such as management of the email accounts, database, etc…Each website has its own database, but sometime a person will run multiple website that share the similar content. In this case, a perfect  solution is to allow the websites to share the same database. (Note: possibly it will increase a load on your database). This is simple to set up through cPanel user interface.

1. Log in to the cPanel control panel with the help of given user name and password by a web host. To access cPanel panel interface type your website domain into the web browser like below:

http://www.website.com/cpanel

2. Move down to the cPanel control panel until you see the databases section. You will see an icon name as a MySQL database. Click on that option to enter in the MySQL administration section.

3. Make a new MySQL database. The top field of the administration area is marked for creating new databases. Type the name you want to use for your database, then click the “Create Database” button to have cPanel create the database for you. Remember, that if you already have a database and are just increasing how many sites can use it, this step can be skipped.

4. Create the user accounts for the database. The second section of the MySQL administration section is for adding database users. Create a new user_name and password for each website that will be sharing a website by clicking the Create “User” button to produce each user account. Later, scroll down to Add User in order to link each user account to the database, and to find out how much access each account will have.

5. Go back to the cPanel home page to access the phpmyadmin database management section. Scroll down and you will see the phpmyadmin option. Click that icon to enter in the phpmyadmin section.

6. Choose your database from the list of databases on the left hand of the screen, then steer to the access controls section of the database. Inside access controls, go to the remote sql section and get into the IP address of each website that will be sharing the database. Enter the IP addresses one at a time, by clicking the “Add Host” button after each one. The web host for the websites can provide the IP addresses if they are unknown.

7. Update the configuration file; typically labeled as a config.php for each website to indicate the proper database credentials. Refer back to the mysql database user accounts you made for each website.