Setting up MySQL Database and User
Before you can install WordPress or WordPress Multisite you first need to create a MySQL database and user on your domain using your cPanel.
In simple terms your MySQL database stores all blog information including files, blog posts and comments and is backed-up almost constantly by your hosting company to ensure no data is lost.
1. Log into cPanel using your account details supplied by your hosting company.
- Appearance of cPanel does vary slightly depending on what theme your hosting company uses.
- Not all hosting companies use cPanel
2. Scroll down to the Database section of cPanel and click on MySQL Databases
3. Create a database by entering the name wpms and clicking create database
4. Once the database has been created click on the Go Back link.
- The name of your database and user are both given the default prefix of your domain name.
- This is to ensure it has a unique name from other databases when it is stored on your host’s servers.
5. Next create a new user by adding their username and password then click Create User.
- Make sure you record your username and password in a safe location as you will need to add this when you edit your wp-config.php file.
6. Once the user has been created click on the Go Back link.
7. Now add your user to your database by scrolling down to Add User to Database and click on Add.
8. On the Manage User Privileges page select All Privileges.
Creating and Editing your wp-config.php file
Now that you have set up your MySQL database and username you need to decide how you want to create your wp-config.php file for your WordPress installation.
The wp-config.php is the file contained in the root of your WordPress file directory which contains the login information for WordPress to connect to your MySQL database(s) as well as table prefix, secret keys, WordPress language and ABSPATH.
You can either:
- Create and edit the wp-config.php file yourself,
- Or skip this step and let WordPress try to do this itself when you run the installation script using the web interface. If you skip this step go to Using a FTP client to install WordPress
The safest way is to manually create your wp-config.php file following the instructions below as the installation script using the web interface doesn’t work for all server setups.
1. Download the zip version of WordPress from wordpress.org
2. Unzip the downloaded file to a folder on your hard drive.
Renaming the wp-config-sample.php file to wp-config.php
1. Locate the wp-config-sample.php file within the wordpress folder inside the wordpress folder you unzipped.
2. Rename wp-config-sample.php file to wp-config.php
Edit your wp-config.php
The next step is you now need to edit your wp-config.php file for your installation.
You do this using a Text Editor program such as EditPlus. EditPlus is a text editor, HTML editor and programmer’s editor for Windows. While you could edit in NotePad, EditPlus offers many powerful features that makes it better suited for editing PHP.
For Mac Users try:
- Smultron – free Text Edit software designed for Macs
- Textmate – Text Edit software you purchase designed for Macs – very good and better suited to text editing
- You must use a text editor program which edits files in plain text format as non-text based word processing program such as Microsoft Word can cause major problems to code when used to edit php files.
You use EditPlus3 as follows to edit your wp-config.php file:
1. Download and install EditPlus3.
2. Locate your wp-config.php file on your hard drive.
3. Right mouse click on your wp-config.php file and select EditPlus 3 to open your wp-config.php file for editing using EditPlus 3.
4. Change the wp-config.php file for your installation by adding in:
- Your database name
- Your username used to access the database
- Your password used by your username to access Database
- The host name of your database server — the host name is usually localhost but if concerned you can confirm by contacting or searching your hosting companies online documentation.
These are all the details you set up when you created your MySQL database and user.
5. Go to https://api.wordpress.org/secret-key/1.1/salt/ to grab authentication unique keys and salts then add them to your wp-config.php file.
- These values can be anything you want them to be — it is just easier to auto-generate them using https://api.wordpress.org/secret-key/1.1/salt/
- These values help WordPress operate securely
6. Finally save all changes to your wp-config,php file and close EditPlus3.
Using a FTP Client to install WordPress
Now that you created and edited your wp-config.php file you are ready to install WordPress following the steps outlined below:
Downloading and Using FileZilla To Install WordPress:
The easiest method of getting files onto your site, and once there, changing them is using a FTP (File transfer protocol) client. FTP works by transferring files from your computer to your site.
FileZilla is free FTP software that works well on all Windows computers. Its screen is split into two halves; left half shows the files on your hard drive and the right half shows those on your web server.
For Mac Users try:
You use FileZilla as follows to install WordPress:
1. Download and install FileZilla
2. Launch FileZilla
3. Enter your domain name, your username and password. NOTE: the same username and password that you use to log into your cPanel.
4. Click Quickconnect
5. Locate and open up your WordPress folder on your hard drive.
6. Double click on your public_html folder to open up the root directory of your site.
7. Hold the SHIFT key, and press the DOWN arrow on the keyboard to highlight all the files and folders in the WordPress folder on your computer and drag it into your public_html folder on your site.
8. Dragging the code from the WordPress folder on your computer into the root directory of your site uploads the WordPress code to your site.
However it doesn’t complete your WordPress installation. Check this by viewing your site in a web browser – you should now see instructions for finalizing your installation of WordPress.
To complete installation you need to add:
a) Your Site Title
b) The password for your admin user — make sure you choose a strong password ad record your password in a safe location as you use this to log into your site.
- Make sure you record the password you have used in a safe location as this password is no longer emailed when you install WordPress.
c) Your email address
Now just click Install WordPress and you should now see a message saying WordPress has been installed and you can now log into your site.
Creating a network by enabling WordPress Multisite
To change WordPress from the standard single site install to a WordPress Multisite which allows you to create a network of sites you need to:
- Update your wp-config.php file
- Choosing the structure of your Multisite in terms of whether you want to use sub-domains or sub-directories
- Create your blogs.dir directory
- Add the extra lines your WordPress installation generates into your wp-config.php
- Add the generated mod_rewrite rules to your .htaccess file, replacing other WordPress rules.
- Set up your mu-plugins folder
You do this as follows:
Updating your wp-config.php file
1. Locate your wp-config.php file on your hard drive.
2. Right mouse click on your wp-config.php file and select EditPlus 3 to open your wp-config.php file for editing using EditPlus 3.
4. Add the following line to your wp-config.php file
above where it says /* That’s all, stop editing! Happy blogging. */:
A common problem that can occur is if you copy and paste the define(‘WP_ALLOW_MULTISITE’, true); from a website into the wp-config.php file into EditPlus 3 or text editing software. Instead of pasting quotes as straight single ticks it pastes it in as curly quotes.
When this happens WordPress won’t recognise the edits you have made. The best way to avoid this is to simply type in manually define(‘WP_ALLOW_MULTISITE’, true); instead of relying on copy and paste. If you have edits that don’t seem to take when you add them to a test editing software, then try this simple fix.
5. Save your new wp-config.php file and upload your new wp-config.php file using FTP into your public_html folder.
6. When you log into your site you should now see the Networks has been added underneath your Tools menu item.
Setting up your sub-domains or sub-directories
1. Now go to Tools > Networks and choose if you want to use sub-domains or sub-directories
- Choose wisely as you can’t change this later
- Contact your host first if you want to use sub-domains to ask if they are able to set up Wildcard DNS records for your site as not all hosting companies support this option
a. Sub- domains
If you want to use sub-domains you will need to contact your host and ask them to set up Wildcard DNS records for your site e.g. log into your support area of pSek and ask them to set up Wildcard dns records for your site.
- Sub-domains have site URLs like site1.domain.tld and site2.domain.tld
- Not all companies allow you to use sub-domains and you need to check with your hosting company before choosing this option.
This is the easier option because you don’t need to get your hosting company to set up Wildcard dns records for your site.
- Sub-directories have site URLs like domain.tld/site1 and domain.tld/site2
2. Once you have chosen between sub-domains or sub-directories and double-checked all details are correct then click Install.
- Your Apache mod_rewrite should already been enabled by your hosting provider. So this is something that generally you don’t need to worry or deal with.
it should be enabled by your hosting providerit should be enabled by your hosting provide
3. Once you’ve clicked Install you should see a page titled Enabling the Network with further instructions for creating your network.
4. Before you commence the next step create a backup of your wp-config.php and .htaccess file by downloading them onto your hard drive.
Create your blogs.dir directory
1. Create your blogs.dir directory in wp-content using FileZilla by clicking on right clicking and selecting Create directory.
2. Add the directory name blogs.dir and click OK.
3. Right click on blogs.dir directory and select file permissions.
4. Set the file permission to 755 and click OK.
Add the extra lines your WordPress installation generates into your wp-config.php
1. Add the supplied code for your wp-config.php file from the ‘Enabling the Network’ page above the line reading /* That’s all, stop editing! Happy blogging. */: and remove the earlier added define(`WP_ALLOW_MULTISITE`, true); line.
2. Save your new wp-config.php file and upload it using FTP into your public_html folder.
Add the generated mod_rewrite rules to your .htaccess file, replacing other WordPress rules.
1. Add the supplied rules for your .htaccess file from the ‘Enabling the Network’ page to replace all other WordPress rules in the .htaccess file with the supplied code.
2. Save your new .htaccess file and upload it using FTP into your public_html folder.
Set up your mu-plugins folder
Before you can install mu-plugins on your WordPress Multisite installation you need to create a mu-plugins folder as follows:
1. Create your mu-plugins folder in wp-content using FileZilla by clicking on right clicking and selecting Create directory.
2. Add the directory name mu-plugins and click OK.
3. Right click on your mu-plugins directory and select file permissions.
4. Set the file permission to 755 and click OK.
Checking out your Network Admin dashboard area
Once you have completed all these steps and uploaded all files — you will need to log back into your install and should now see the Network Admin link in the top right of the WordPress Admin.
The Network Admin dashboard is a feature of WordPress Multisite only; you won’t see the Network Admin link on a single install of WordPress. This link is only viewable, and accessible, to users who have been granted Super Admin privileges for the Network.
The “Network Admin” dashboard is a separate dashboard area for all Network Management on a WordPress Multisite install.
Once in the Network Admin dashboard you can quickly change back to the normal WordPress admin area, called the “Site Admin” Dashboard, by clicking on the “Site Admin” link.