There are two things that almost any online author is bound to experience in their travels: cPanel administration software and a content management solution like the ever-popular WordPress. And this means that virtually every online author will have to eventually learn how to create a MySQL database which is capable of holding the data produced by WordPress–including pages, posts, comments, and anything else which may be created down the road by plugins and custom functions.
The cPanel software is easily the most popular web-based administration panel on the planet, and it’s used by a variety of both Windows and Linux-based web hosting providers. There are a few simple steps to take when creating a new database, and this tutorial will make the process as easy as possible for those who are new to administering their own web hosting plan, dedicated server, or content management software solution.
Create a MySQL Database in cPanel
Step 1: Authenticate with cPanel in Order to Make Changes
Perhaps one of the quirkiest things about cPanel is the way it requires users to log in. While some web hosts have installed the software so that it can be easily accessed by going to a URL like “
domain.com/cpanel,” still other web hosts only allow the control panel software to be accessed by placing a port number after a website’s URL.
This is confusing to users of all levels, mostly because there is a lack of consistency among web hosts. Also, port numbers are generally reserved only for use within FTP clients, and most people don’t know how to properly construct a URL with a port number included at the end. So, here’s how a URL looks with a port number added to the end of it:
Generally, port numbers are between two and five numbers in length. For the average cPanel installation, the number is typically four. By default, cPanel is accessible at port number 2082. The user’s URL, then, would look like the following:
Typing this URL into a web browser will likely result in one of two login varieties. The first, and most common, is the pop-up dialog box which asks for a user’s username and password. The second is a web-based login form which resembles any traditional website’s login area. No matter which of these pops up, enter the site’s administrator username and password. These are included in the initial email sent from the web host and they are the same credentials used to access the site’s FTP server in many instances. When logged into the cPanel interface, proceed to the next step.
Step 2: Finding the MySQL Control Panel Area and Creating a New User
Another quirk about cPanel is that it can be easily “skinned” or “themed” by a user’s web host, making a universal interface a near impossibility. For this reason, there is no way to accurately define where the MySQL control panel link will be placed on the resulting homepage after a user logs in. However, most websites do group all database-related tools into a group called (self-evidently) “Database Tools.” Within this grouping will likely be a link to the database manager which is labeled “MySQL” or “MySQL Databases.” This link should not be confused with the “phpMYadmin” link which is contained within the same box. Click through to the MySQL Databases control panel area.
Within this section of cPanel software, users can do two things: add users and add databases. Every database must have a user assigned to it in order for the data itself to be accessible, so it makes sense to define a user before creating a database. This can be done by scrolling down on the page until the “Add New User” area of the page appears. This is usually placed under a “MySQL Users” heading. This is displayed as two text boxes, which allow the site administrator to enter a username and password, and then create the user by clicking submit.
At this stage, a new username should be defined and a complex password should be assigned to that user. Remember both of these pieces of information (perhaps write them down on a post-it note), as they will need to be entered correctly in order for any software like WordPress to read and write from the new database.
Upon submitting the form to create a new user, site administrators will be presented with a screen where they can define permissions for the user. This area should have all permissions checked, and should optionally include a box labeled “ALL Permissions.” It’s essential to allow the user to perform all of these operations so that the site can function smoothly and data can be added, edited, or removed, without errors. When the permissions are properly set, save that information and wait for the page which confirms success. After this page appears, click “Go Back” to create the database for use by the website.
Step 3: Creating the New Database in cPanel
Now that the user has been created, it’s time to make a new database which can be used by WordPress or other forms of content management and discussion software. On the same “MySQL Databases” page where the user was located, site administrators will notice a “Create New Database” dialog box right at the top of the page. This will often contain some form of prefix (your site’s domain name, perhaps) followed by an underscore and then an empty text box. That empty text box will contain the name of the new database, and database’s name can be anything a user wishes to make it. In most cases, it’s good to name the database according to its main function or the piece of software which will use the database primarily.
Once the database name has been entered, a green checkmark may appear next to the text box in many cases, indicating that the form is ready for submission. Go ahead and submit the form, and wait for the “Success! Go Back.” page to appear just as it did after creating the user with full permissions. Once this page has appeared, the database is ready for use. However, the process is not yet complete. Once again, click the “Go Back.” link and return to the MySQL Databases administration page.
Step 4: Adding the User to the Database to Enable Read and Write Functions
As it stands, a user has been created and a new database has been established to go along with that new user. However, both things are essentially useless at this point. The function of a user is to enable access to the data within a database, and a database is designed not to receive or transmit data without a user attached to it. The final step in database creation is to “assign” a user to the database. Remember that a user’s permissions are universal and they will apply to every database which a user is assigned to.
On the MySQL Databases page within cPanel, scroll down to the very bottom of the page. This area serves two functions. First, it lists all of the users created for use by all of the databases within cPanel. Here, site administrators will be able to see the user they created in the second step of this tutorial. Above that list of users, a simple function appears which allows administrators to add a user to a database. This is what makes the whole process work seamlessly.
In this field, add the user account which was created in step two to the database which was created in step three. Then, simply press the “submit” button. The cPanel interface will process the information briefly and then, as always a page stating success and a “Go Back” link will appear. This indicates that the process is complete and that the database has been given a user. When the database name, username, and user password are combined, they enable software applications like WordPress and discussion forum implementations to read and write information, enabling interaction and content publishing.
Step 5: Alternative Ways of Creating and Administering a MySQL Database Using cPanel
Why the method described above is easily the most common way of creating databases within the typical instance of cPanel, it is far from the only way to achieve a new database. In fact, at least one alternative method of database creation is even easier than the method mentioned here. That method involves using a separate control panel feature known as “Fantastico.”
Many web hosts included the Fantastico software for their users, as it allows them to create databases and install software to their server or web hosting plan with a few simple clicks after providing basic information. Users simply navigate to the Fantastico control panel element from the cPanel homepage and select the software they wish to install from a list on the lefthand side of the screen. Then, they’ll see a dialog box asking for their username and administrator password which they wish to use for the new software as well as some basic installation settings.
After this information has been filled in, the Fantastico software will automatically install the package a user selected and it will automatically create a brand new database for the package that it installs. That database will be given a name that corresponds to the installed package, and Fantastico will automatically generate a username and password, and assign that new user to the created database with full permissions. For those users who want to use a piece of software listed within Fantastico (WordPress Joomla, Drupal…), this is the fastest way to get online and create a database without having knowledge of the broader cPanel interface.
Another method of creating a database involves using the “phpMYadmin” software which administrators were steered away from at the beginning of this tutorial. It’s definitely a more advanced solution and will likely only appeal to the seasoned developer or website administrator. However, the phpMYadmin software allows for administration of database tables, rows, and cells, and enables performing advanced database queries and defining advanced options when creating databases and users. It’s by far the best way to achieve a customized database solution within cPanel.
Users of the phpMYadmin method will need to click the relevant link within the cPanel control panel software and wait for the new page to load in a separate window. In many instances, administrators will be logged into phpMYadmin automatically using the credential information from their cPanel session. If this doesn’t happen, administrators should simply enter the same username and password that they use to access the cPanel interface itself.
Once the phpMYadmin interface loads completely, users will see the relevant links to create database users, create databases themselves, and to link these two important pieces of information so that software applications can read the database, modify its contents, and submit new information. As always, take care when creating and assigning users, and ensure that they have full permissions within the database so that the widest array of applications can function properly.
Easy to Do, and Just the Beginning of cPanel Functionality
Website administrators who are new to the web hosting game need to be familiar with cPanel, and creating a database is the best way to start this process. The cPanel software is a powerful way to control almost every function of a website and get the most out of a standard web hosting package. In addition to databases, users can manage email addresses, subdomains (good for content management systems), backups, web hosting account features, and much more.
Remember to always create a database with care, and always have an eye on security. Database usernames should not be easy to guess, and the passwords assigned to those usernames should be even more difficult. While users with full database permissions are optimal for most pieces of software, this large set of permissions also makes them a huge security target and a real liability for many website operators. Using a highly secure set of usernames and passwords will ensure the highest level of security and severely limit the risk a website is exposed to with this type of database user.
- 5 Things a Modern CMS Shouldn’t Do
- Conditional Variables and Database Queries in WordPress
- How to Install Multiple WordPress Websites into a Single MySQL Database
- How to Integrate Paypal With WordPress
- Building Client-Proof WordPress Websites
- How to Create an Emergency Message UI in WordPress
- How to Add Conditional Logic to Your WordPress Theme
- 5 Cool Things You Can Do with a Local Install of WordPress