Installing WordPress on Raspberry Pi

Please share with your friends...
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

⇐ BackPageNext ⇒

MySQL

MySQL is a is a free, open-source, and widely used relational database management system (RDBMS). It is a popular choice of database for use in web applications.

  1. To install MySQL, use the following package install command:
    sudo apt-get install mysql-server mysql-client -y
  2. Part way through the installation, you will be prompted for a New password for the MySQL “root” user.
    New password for the MySQL "root" user

    New password for the MySQL “root” user

  3. You will be prompted to Repeat password for the MySQL “root” user.
    Repeat password for the MySQL "root" user

    Repeat password for the MySQL “root” user

    Once you’ve confirmed the password, MySQL Server will finish installing and the service will start.

  4. To connect to our local MySQL Server instance and create a new database and user, use the following command:
    mysql -uroot -hlocalhost -p

    You will be prompted for the root password you set previously. You should now see something that looks like this:

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 43
    Server version: 5.5.43-0+deb7u1 (Debian)
    
    Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MySQL>
  5. Use the following MySQL command to create the new WordPress database. For simplicity I’ve called this database wordpress, however, just substitute with a name of your choice:
    CREATE DATABASE wordpress;

    You will receive the following response:

    Query OK, 1 row affected (0.00 sec)
  6. Use the following MySQL command to create a new database user. Again, for simplicity, I’ve called this user wordpress with a password of Password1, but as previously you can call the user anything you like. Give your database user a strong password.
    CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'Password1';

    You will receive the following response:

    Query OK, 0 rows affected (0.00 sec)
  7. Use the following MySQL command to grant our new wordpress user full access rights to the wordpress database:
    GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';

    You will receive the following response:exit

    Query OK, 0 rows affected (0.00 sec)
  8. Flush the privileges for the account changes to take effect:
    FLUSH PRIVILEGES;

    You will receive the following response:

    Query OK, 0 rows affected (0.00 sec)
  9. Finally, exit the MySQL Command Line Interface:
    EXIT

    You will receive the following response:

    Bye
  10. As a quick test, login using the of your new database user account:
    mysql -uwordpress -hlocalhost wordpress -p
  11. When prompted, type the password that you gave to your new database user account. You should be logged into the MySQL Command Line Interface without error.
  12. Exit the MySQL Command Line Interface:
    EXIT

MySQL is now installed and configured for use with WordPress.

⇐ BackPageNext ⇒

Please share with your friends...
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

4 comments

  1. Thanks for this tutorial, Chris. I was just wondering, do you have any tips for helping to “harden” the web server? I guess I’m a tiny bit paranoid and wish to deter would be intruders …

    1. Hi Ben,

      The Nginx configuration is already very lean and should be secure (barring code vulnerabilities – remember to keep Raspbian and WordPress updated!).

      However, you will get lots of bruit-force login attempts though the standard WordPress Log In page. I decided to use a Google Authenticator plugin to enable two-factor authentication.

      Kind Regards,
      Chris.

  2. Excellent tutorial!
    I’m getting blank page with index.php like but not when i remove “!–” to
    What would be the steps to add multi-site subdomain such as – http://www.example.com and wiki.example.com?

    1. Hi idris,

      Thanks for letting me know about the “!–” for the phpinfo() page – that was a bug in my tutoral!! I’ve fixed it up now 🙂

      If you have followed all the steps in the tutorial, you should be setup for multi-site subdomains. You just need to run the configuration.

      The most important steps of the tutorial for WordPress multi-site are:
      PHP step 5 – adding *.example.com to the server_name list; and
      WordPress step 17 – adding the WP_ALLOW_MULTISITE line to wp-config.php.

      This bit is from memory (I need to write a tutorial on this bit too). Log in to the WordPress Dashboard and go to Tools > Network Setup. You should have the option of creating a Subdomain or Subdirectory site install.

      http://codex.wordpress.org/Create_A_Network

      Also, for a Subdomain setup to work, WordPress expects that you have DNS wildcard subdomains setup with your DNS provider.

      Hope that gets you started! 🙂
      Chris

Leave a Reply