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
- Log in to your Homer or Dante account.
ssh firstname.lastname@example.org or
- Press the O key for Other, then press the W key to drop into the Web development environment. Stay in your home directory.
- Run the MySQL setup script:
In order to get the script to run successfully, you have to answer the prompt by typing the word “yes.”
- Get the path to your home directory:
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
- Your port number must be between 1024 and 65000; the number cannot currently be in use.
- Find a “free” port number by testing a number (xxxxx):
telnet localhost xxxxx
- If the server returns “Connection closed by foreign host,” try another number.
- 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.
2. Copy and paste the following lines into the file, making the substitutions listed below:
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.
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.
2. Next, run the script that writes the privilege tables and sets up default privileges for users of your MySQL server:
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).
- To start MySQL
Press enter to return to the command prompt.
- 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
- 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
- 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;
- 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:
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.