Installing WordPress On UW Servers : Part 1

Installing WordPress on a UW account — student or faculty — is not for the faint of heart.

  • It requires familiarity with a command line interface (but you can copy-and-paste to your heart’s content – almost). Mac and Linux users can use terminal; Windows users need Tera Term or another terminal emulator.
  • Throughout this tutorial, text in italics represents what you’ll be writing or typing in the command-line interface.

But before we can configure WordPress, we need to install MySQL and create a database that WordPress can access. We’ll do the MySQL work in two parts and then install WordPress.

Part 1: Installing MySQL

We are going to follow the recommended procedure: use UW installed binaries. You’ll need to use a command-line client for this step.

Step 1. Run MySQL script and get the path to your home directory

  1. Log in to your Homer or Dante account.

    ssh uwnetid@homer.u.washington.edu or
    ssh uwnetid@dante.u.washington.edu

    ssh login

    LogIn Using SSH

  2. Press the O key for Other, then press the W key to drop into the Web development environment. Stay in your home directory.
    terminal - UW

    Select "Other"

    terminal - uw

    Select W For Web Development

  3. Run the MySQL setup script:

    mysql-local-setup

    In order to get the script to run successfully, you have to answer the prompt by typing the word “yes.”

    terminal - uw

    Running the MySQL install script. You must type "yes" (not just a "y").

  4. Get the path to your home directory:

    echo $HOME

    Note this, as you’ll need the information in a few steps. It will look something like this: /hw13/d06/accountname where accountname is the UWNetID for this account.

Step 2. Configure a port for MySQL

  1. Your port number must be between 1024 and 65000; the number cannot currently be in use.
  2. Find a “free” port number by testing a number (xxxxx):

    telnet localhost xxxxx

  3. If the server returns “Connection closed by foreign host,” try another number.
  4. If the server returns “Connection Refused”, you have a good number. Write it down.

Step 3. Create your .my.cnf file

1. Create a new file called .my.cnf in your home directory. This file contains account-specific settings for your MySQL server.

pico ~/.my.cnf

2. Copy and paste the following lines into the file, making the substitutions listed below:

[mysqld]
port=xxxxx
socket=/hw13/d06/accountname/mysql.sock
basedir=/hw13/d06/accountname/mysql
datadir=/hw13/d06/accountname/mysql/data
skip-innodb

[client]
port=xxxxx
socket=/hw13/d06/accountname/mysql.sock

Replace the two instances of xxxxx with the port number you found in the previous step. Replace /hw13/d06/accountname with the path you wrote down in step 1.

To save the file, press Control-X (^X) and then press “return” to tell the server to write the file.

Terminal

Illustration of terminal window (Apple) with my.cnf document text. Remember to save the document!

Step 4. Run the MySQL Install Script

1. Make sure you are in the mysql directory. If you aren’t sure where you are, just type the <ls> command to list the files in the current directory. Typing <cd> will take you back to the home directory, then typing <cd mysql> will put you in the mysql directory.

ls

mysql file structure

If <ls> returns a similar file structure, you are "in" the mysql directory

terminal

If <ls> returns this file structure, you need to change directories (cd).

2. Next, run the script that writes the privilege tables and sets up default privileges for users of your MySQL server:

scripts/mysql_install_db

The mysql_install_db script may take a while to run. The script informs you that you need to set a root password. We will do that next.

Step 5. Set the MySQL Password

Start MySQL and set a new “root” password. This password should be very strong: upper and lower case letters, numbers, special characters — but no dollar sign ($). Write it down (you’ll need it later).

  1. To start MySQL

    bin/mysqld_safe &

    Press enter to return to the command prompt.

  2. Use the following command to set a new root password. Remember, no $ in this password! This password should be very strong and does not need to be memorable.

    bin/mysqladmin -u root password “mypassword

You have now created a “root” account and given it a password. This will enable you to connect to your MySQL server with the built-in command-line MySQL client.

Step 6. Connect To MySQL Server

  1. Type the following command to connect to the server (you’ll be prompted for the root password that you just created; the cursor will remain stationary as you type the password):

    bin/mysql -u root -p

    uw terminal 5

    Connecting To Server; Note: you are in terminal server mode (<psh>)

  2. At the mysql> prompt, type the commands that follow, replacing mypassword with the root password. Press [enter] after each semicolon. This step allows you to connect to your MySQL server as ‘root’ from any UW computer.

    mysql> use mysql;
    mysql> delete from user where Host like “%”;
    mysql> grant all privileges on *.* to root@”%.washington.edu” identified by ‘mypassword‘ with grant option;
    mysql> grant all privileges on *.* to root@localhost identified by ‘mypassword‘ with grant option;
    mysql> flush privileges;
    mysql> exit;

    mysql screenshot

    Issuing MySQL commands; you are in <mysql> mode.

  3. Once back at your shell prompt, you can verify that your MySQL server is running with the following command:

    bin/mysqladmin -u root -p version

    If MySQL is running, a message similar to the following will be displayed:

    uw terminal 6

    Evidence That MySQL is running. We are back in terminal server <psh> mode.

Part 1 is done! A MySQL server is now running in your account and is ready to accept connections. Next: Administering MySQL with MyPHP Admin.

One thought on “Installing WordPress On UW Servers : Part 1

Leave a Reply