How to Create a Database in cPanel?

Creating a database in cPanelcan be a tough task. So, before start building your database, you need to know what a database is and how you can create it without any hassle.

A database is defined as a simple collection of information or records over the web. Databases are needed to operate many web-based applications like online retail shops, content management systems (CMS), and bulletin boards. They come with different sizes depending on the user and the objectives. There are numerous programs used to create a database in cPanel, but here I’m going to explain creating a MySQL database in cPanel.

Nowadays, MySQL is a trendy database among web developers. Its best features such as speed and small size make it ideal for a website. Additionally, it is an open-source program that can be run on various operating systems like Windows, Mac OS, and Linux, and it’s also offered for all almost all web hosts.

When you create a database in cPanel, most of theusers are unaware that there are a number of other things that you need to do as well. The new MySQL database creation process involves following steps:

Step 1:   Creating a database

Step 2:  Creating a database user

Step 3:  Giving user access to work with database

Step- 1: Create a MySQL Database in cPanel:

  1. Log into your cPanel.
  2. Once login, then click MySQL Databases.
  3. Next to New Database field and just enter a name for your database.(There will be little differencein actual database name you have selected. The reason is that it will be created with your cPanel username and with an underscore added before the name you selected. For example,domain_database)
  4. Click Create Database.

The MySQL database is created and ready to use. Now, in order to be able to manage and maintain the database, database User should be created.

Step-2: Create a MySQL Database User:

  1. Log into cPanel if you’re not logged in.
  2. Click MySQL Databases.
  3. Next to MySQL Users in the top-right corner of the page.
  4. Enter a username under thesection of Add New User.
  5. Enter a password in the Password section.
  6. Retype the password in the Password (Again) section.
  7. Click Create User. (The database username will look like “domain_jack”)

After creating a database user, the next phase is to giving the database access to the user touse it. In this step, user select the privileges which determine how the user is able to interact with the database

Step-3: Add a User to Access Database

  1. Log into cPanel.
  2. Select MySQL Databases.
  3. Under the Add User to Database section, pick a user from the User drop-down menu.
  4. From this menu, choose the database to which you want to allow the user access.
  5. Click Add user.
  6. The MySQL Account Maintenance screen will appear. Select all the privileges or choose some specific ones you wish to grant the user.
  7. Click Make Changes.

It is important to note that you can add a single user to multiple databases if you need to do this. Once you have connected a user with the database, you will see a list which provides more details about the database. Such as, it will show you the database name followed by some links to repair or remove and then you will be able to see all the users. It will also notify you some sample code that describes you how to connect to the database in different other programs like Perl, PHP, or JDBC script.

After knowing how to create a database, the next question that will come in your mind is that can you delete the database or user. The answer is yes. You can delete both database and user.Now, let’s have a look at how you can remove the database and user!

Delete a Database:

  1. Find the Current Databases section under the MySQL Databases.
  2. A table will appear. Go to the Actions column of the table and just click the Delete Database. It will allow you to delete your desired database.

Delete a Database User:

  1. Find the Current Users section under the MySQL Databases.
  2. A box will appear. In the Delete column, just click the X sign to delete the user.


More Posts

Send Us A Message