WordPress’ success owes much to its quick and simple five-minute installation procedure. Yet the MySQL database still causes confusion for many.
This tutorial describes how to create a database using cPanel, a popular platform management utility offered by many web hosts. We’ll also discuss how to use this database during a WordPress installation. The techniques can be used by any web application which requires MySQL.
Let’s start with the basics and terminology…
What is a Database?
A database is a collection of organized data. That’s it. WordPress stores all its page, post, category and user data in a database.
MySQL is a database management system (DBMS). It is software which allows you to create, update, read and delete data within a database. A single MySQL installation can manage any number of self-contained databases. You could have one for WordPress, another for Magento, and others for Drupal or whatever you need.
There are plenty of alternatives but MySQL became popular for several reasons:
- it is free, open source software. It is now owned by Oracle but there are open MySQL-compatible options such as MariaDB.
- it became synonymous with PHP - the web’s most-used language/runtime which powers WordPress. Both PHP and MySQL appeared in the mid-1990s when web development was in its infancy.
- it adopts Structured Query Language (SQL) - a (fairly) standard language for creating data structures and data.
- it is fast, simple to install and has many third-party development tools.
How do Applications Access a Database?
Applications such as WordPress access their data via a database connection. In the case of MySQL, WordPress’ PHP code can only establish a connection when it knows:
- the address where MySQL is installed
- the name of the database it needs to access
- a user ID and password required to access that database
A database “user” account must be defined for WordPress use. It can have a very strong password and set appropriate database permissions.
How is Data Stored?
MySQL and other SQL databases store data in relational tables.
For example, you may have a set of article posts. Each post will have unique data, such as the title and body text. It will also have data used in other posts, such as the category and author details. Rather than repeat the same data again and again, we create separate tables:
- an
author
table containing an ID, the author’s name and other details - a
category
table containing an ID and the category name - a
post
table containing the article title and body text. It would point to the author and category by referencing the associated ID number.
SQL databases implement safeguards to guarantee data integrity. You should not be able to reference an author ID which does not exist or delete a category used by one or more articles.
These table definitions and rules form a database schema. A set of SQL commands execute during WordPress installation to create this schema. Only then are the tables ready to store data.
How to Create a Database
Web hosts using cPanel provide a web address (such as https://site.com/cpanel), and a user ID and password to gain access. Keep these details safe. Do not confuse them with the database or WordPress user credentials!
You view may look a little different but locate the DATABASES section or enter “MySQL” in the search box.
Click the MySQL Database Wizard and follow the steps:
Step 1: Choose a Database Name
Your database requires a name:
Continue reading %How to Create WordPress MySQL Databases on cPanel%
by Craig Buckler via SitePoint
No comments:
Post a Comment