Knowledge Base
MilesWeb / cPanel

MySQL Database (cPanel)

Approx. read time : 3 min

What is Mysql ?
MySQL is the most widely used open source SQL database system. MySQL Databases allow you to store lots of information in an easy to access manner. The databases themselves are not easily read by humans. MySQL databases are required by many web applications including some bulletin boards, content management systems, and others. To use a database, you’ll need to create it. Only MySQL Users (different than mail or other users) that have privileges to access a database can read from or write to that database. MySQL databases are available with our web hosting packages.

Create a MySQL Database
Login to your cPanel & access MySQL Databases option. Enter the database name under Create a New Database & click on Create Database. The format of database name is cPanel-user_name.

Read: How to create/delete MySQL Database

Adding & assigning a MySQL user to the database
Once you create a database you will need to add a user & assign it to the mysql database. Enter the database username under Add New User option. Set a password to it & Click on Create User. Now, you will have to assign that user to the database. This will help you to connect the mysql database on the server locally OR remotely. Select the database & user from the drop down under Add User To Database. Click on Add. Assign the privileges accordingly. Mysql privleges are CREATE, CREATE ROUTINE, CREATE VIEW, DROP, INDEX, LOCK TABLES, etc. Click on Make Changes & you are done.

Removing MySQL user assigned to MySQL database
Under Current Users, you will find the list of users created. In front of the user, you will find a cross button. Click on it to remove the MySQL user. If you just want to remove the assigned user, you can click on Cross Sign for the users under Current Databases option. This will not delete the user. But, will removed the assigned user to MySQL database.

Deleting MySQL Database
You will get the list of domains under Current Databases. Click on Delete Database under heading Actions. This will remove MySQL database from the server.

Accessing phpMyAdmin
A tool written in PHP intended to handle the administration of MySQL over the web. Under cPanel, you will find phpMyAdmin. Click it & you will be redirected to the new interface from where you can manage the databases. You can excute the queries, import/export the databases, modify/replace values, etc.

Read: MySQLi error while accessing phpMyadmin
Read: phpMyadmin Error

Allow other hosts to access MySQL database remotely
You can allow external web servers to access your MySQL databases by adding their domain name to the list of hosts that are able to access databases on your web site. Access option Remote MySQL from your cPanel. Enter the IP address of the host/server to which you wish to allow access to. Click on Add Host. If you want to enable access to all, enter ‘%’ which will work as a wildcard. Enabling wildcard is a security risk though.

What is the hostname for MySQL ?
If you are using a connection string to connect MySQL database locally, use hostname as ‘localhost’. If you are trying to connect the database remotely, use server hostname OR server IP address.

admin
With over 10+ years of experience in the web hosting industry, I have achieved extensive exposure to result-oriented methodologies. And expertise in different domains like Datacentre Services, Cloud computing technology, Web hosting industry and many more.