[Ubuntu Server] How to create a database for wordpress using MySql
by Riley MacDonald, November 9, 2017

While installing WordPress on my headless Ubuntu server I needed to create a new MySQL database. Most of the examples I saw online used interfaces such as cPanel to accomplish this. Here’s how I did so using the command line:

First enter the MySql shell by executing mysql on the command line. Once in the mysql shell execute CREATE DATABASE wordpress;. This creates a new database named “wordpress”. I then executed the command SHOW DATABASES; to verify the database existed as required.

When installing/configuring the server I used a default password “root” for mysql. This post shows how to change the mysql password using the command line.

CREATE DATABASE wordpress;
Query OK, 1 row affected (0.02 sec)
 
SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| wordpress          |
+--------------------+
5 rows in set (0.01 sec)

Voila, I can now update the wordpress wp-config file to use the wordpress database and continue the rest of the install process.

Open the comment form

Leave a comment:

Comments will be reviewed before they are posted.

User Comments:

Be the first to leave a comment on this post!