This tutorial describes how to create a database using cPanel, a popular platform management utility offered by many web hosts. MySQL databases are generally confusing to many. The technique we will describe can be used by any web application that requires MySQL.
What is a database?
A database is a collection of organized data. For example, WordPress stores all of its pages, posts, categories, and user data in a database.
MySQL is a DataBase Management System. It is software that allows you to create, update, read, and delete data. A single MySQL installation can manage any number of stand-alone databases.
There are many alternatives, but MySQL has become popular for several reasons:
- it is free open-source software. It is now owned by Oracle, but there are also open options compatible with MySQL, such as MariaDB.
- it has become synonymous with PHP, a programming language that is one of the most used on the web, and that runs WordPress. Both PHP and MySQL emerged in the mid-1990s when Internet development was in its infancy.
- adopts Structured Query Language, a fairly standard language for creating data structures and data.
- It is fast, easy to install, and has many other development tools.
How do applications access the database?
Applications like WordPress access their data through a database connection. In the case of MySQL, WordPress’s PHP code can only establish a connection when it knows:
- the address where MySQL is installed
- the name of the database to access
- the user ID and password required to access that database
How is the data stored?
MySQL and other SQL databases store data in relational tables.
For example, you may have a set of posts. Each post will have unique information, such as the title and body of the text. It will also have the information used in other posts, such as category and author details. Instead of repeating the same data over and over again, we create separate tables:
- author table containing ID, author name and other details
- a table of categories containing the ID and name of the category
- a table with a post containing the title of the article and the text of the text. Indicates the author and category by referring to the associated ID number.
SQL databases implement safeguards that guarantee data integrity. You cannot refer to an author ID that does not exist or delete a category used by one or more articles.
These table definitions and rules make up the database schema. A set of SQL statements is executed during WordPress installation when creating this schema. Only then are the tables ready for data storage.
How to create a database?
Hosts that use cPanel provide a web address (such as https://site.com/cpanel) and a user ID and password to access. Keep these details safe.
Select the MySQL Database Wizard option and follow the next steps which are quite intuitive.
You are then asked to create and name your new database.
The prefix is usually used in the name of the site name_ and the appropriate database name is entered below. Enter an appropriate name such as blog or WordPress and click Next Step.
The next step is to create and define database users.
Note that the username will often have the same prefix as the database, in this case, website_name of the username.
cPanel will ensure that you enter a strong password, which must be strong, in order to protect access as much as possible and increase the security of the database. Therefore, make sure that your username and password are stored in a safe place.
Then you determine the privileges of access to the user, that is, everything that he will be able to change and update. In these few steps, you used cPanel to create a new MySQL database in a WordPress application.
Visit our News & Stories page, we have prepared educational content for you.