24) Creating a WordPress database on your Raspberry Pi

<-- Previous    Next –>

This page describes creating the database needed for WordPress. You can do this using the phmMyAdmin web interface, or you can do it from the command line of the terminal. This page describes using the terminal command line interface.

Run mysql in the terminal window:

sudo mysql -uroot -p

Enter the root password you created previously for your mysql installation.

This will log you into the MariaDB command line interface.

Create the database for your WordPress installation as follows:

MariaiDB [(None)]> create database wordpressdb;

In the above example, I have named the database ‘wordpressdb’ but you can use any name you want.

Don’t forget to put the semi-colon at the end of the statement.

The terminal should say that a new row has been created indicating that the database was created.

Now create a user and grant database privileges to the new user. Note: you will need to enter your own password after IDENTIFIED BY. I am creating a user called ‘wordpressuer’, but you can use whatever name you want.

MariaiDB [(None)]> GRANT ALL PRIVILEGES ON wordpressdb.* TO ‘wordpressuser’@’localhost’ IDENTIFIED BY ‘YOURPASSWORD’;

Then flush the database privleges:

MariaiDB [(None)]> FLUSH PRIVILEGES;

Make a note of the database name, database username and password as you will need all of those values for the connection to WordPress.

You can check that you have created the database by entering the following in the terminal:

MariaiDB [(None)]> show databases;

You can also check that you have created the user by entering the following in the terminal:

MariaiDB [(None)]> select host, user, password from mysql.user;

This will display the password in encrypted form of course.

Exit the MariaDB prompt with Ctrl + D.

Note that you could do the above using the phpMyAdmin interface. You can create the database and then enter the GRANT SQL script into the SQL execute box.

<-- Previous    Next –>