What's WP
Find Everything Related to WordPress - Best Tutoriasl on WordPress!
How to Create MySQL Database and User For WordPress?

How to Create MySQL Database and User For WordPress?

Database is an essential part of WordPress to store the site data and information. Many reliable web hosting utilize MySQL as their database management system, but a variety of beginners and non-technicians are troubled to handle MySQL databases. This tutorial is specifically designed to solve this problem, helping readers easily create their MySQL databases and users with step by step tips.

In the below content, we mainly introduce 3 methods, creating MySQL database directly, via phpMyAdmin, and utilizing command lines.

Create MySQL Database Directly

In general, every web host comes with an easy-to-use control panel to help manage your site, files, databases, domains, and everything with ease. You can also log into it and start to create your MySQL database. In the below, we demonstrate the entire process through the cPanel of Zhuji91.com.hk.

Log into the control panel and scroll down to the Databases section, click on MySQL icon.

click on MySQL

Then, you will be redirect to the MySQL database panel, where you can create a new database, modify the current databases, add new users, and so on.

It’s quite easy to create a new database. Enter the database name in the field under the Create New Database section and then click on the below button.

create new database

Continue to scroll down the page until you see the section of MySQL Users. First of all, you can add a new user by filling the username, password, again password. Finally, click on the Create User button.

create new user

You still don’t complete the process unless you have added the user to the database. Go to Add User to Database, select your users and the corresponding database, click Add button at last.

Add user to database

Create MySQL Database via phpMyAdmin

phpMyAdmin is an open source tool used to deal with MySQL database through an online web browser. It can completely control the management of MySQL, including database, users, tables, rows and fields, etc.

You can directly log into your phpMyAdmin interface or click on the phpMyAdmin icon under the Databases section in the control panel.

click on phpMyAdmin

Then, go to the phpMyAdmin panel. Here you can find all your databases on the left and view the data. Click on the Database tab on the top right and configure the database information.

create new database phpmyadmin

At present, you are required to create a user for the database. Go to the Privileges tab and click on Add a new User. Finish the table by entering your username, host, password, again password. Only note that the host should be set as Localhost if your WordPress site and MySQL database are on the same server.

add a new user phpmyadmin

In the next, you need to edit privileges for the created user by clicking on Edit Privileges.

edit privileges phpmyadmin

Once chose a database, you will be link another page where you can configure the database privileges like the below. In order to install WordPress securely, you can be freely to grant all privileges excludes the Administration privileges to a user.

specify database privileges

Create MySQL Database with SQL Query

If you are a developer and familiar with SQL query, using the below code helps you easily complete the process and saves a lot of time. Only remember to modify the database_name and site domain with your own values.

sql query code


Joyce is a professional writer & SEOer who loves trying new things and sharing the experience through blogging. She loves clean design, playing with different WordPress themes, SEO, etc. Very often, you could find her in various WordPress event as invited speakers.