Running multiple WordPress instances is easy when you have multiple databases and directories at your disposal, but often you only get x1 database and x1 hosting folder when you sign up with a web provider.
Here’s how to run multiple instances of WordPress from their own urls out of subfolders in your personal hosting space.
First, we need to create some MySQL users for assigning permissions to the database (I have created a fictional database ‘wpdb’ here). You could also do this using a GUI based tool like phpMyAdmin if you are more comfortale with that.
mysql> create database wpdb;
Query OK, 1 row affected (0.00 sec)
mysql> create user 'wp1'@'localhost' identified by 'wp1';
Query OK, 0 rows affected (0.00 sec)
mysql> create user 'wp2'@'localhost' identified by 'wp2';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on wpdb.* to 'wp1'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on wpdb.* to 'wp2'@'localhost';
Query OK, 0 rows affected (0.00 sec)
Inside my web hosting folder I created x2 subfolders, ‘blog-one’ and ‘blog-two’, so my hosting directory looks like this

Next I download the latest version of WordPress from http://wordpress.org/latest.zip to my folder. Unzip the latest.zip file, it will expand the contents out into a ‘wordpress’ folder in the current directory.
Copy the contents of the ‘wordpress’ directory into the blog-one and blog-two folders.
Now go into the the blog-one folder and rename ‘wp-config-sample.php’ to ‘wp-config.php’.
Edit the ‘wp-config.php’. file with your favourite editor and set the following values:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wpdb');
/** MySQL database username */
define('DB_USER', 'wp1');
/** MySQL database password */
define('DB_PASSWORD', 'wp1');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_1_';
Now go into the the blog-two folder and rename ‘wp-config-sample.php’ to ‘wp-config.php’.
Edit the ‘wp-config.php file with your favourite editor and set the following values:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wpdb');
/** MySQL database username */
define('DB_USER', 'wp2');
/** MySQL database password */
define('DB_PASSWORD', 'wp2');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_two_';
What this will do is re-use the single database, but create uniquely named tables for each instance.
The url for my normal site is http://ubuntu.lan and here you can see the blog folders ready to use in my main folder.

I can access these WordPress instances by going to ‘http://ubuntu.lan/blog-one’ or ‘http://ubuntu.lan/blog-two’. But I don’t want my site url to be anything to do with these blogs, so we can use url rewriting to change them.
Create a .htaccess file with the following contents and place it into your root web hosting folder.
RewriteEngine On
RewriteCond %{HTTP_HOST} site2
RewriteCond %{REQUEST_URI} !^/blog-two
RewriteRule ^(.*)$ blog-two/$1 [L]
RewriteCond %{HTTP_HOST} site1
RewriteCond %{REQUEST_URI} !^/blog-one
RewriteRule ^(.*)$ blog-one/$1 [L]
This will allow me to use the url ‘http:/site1′ and ‘http:/site2′ to reach my blogs. Site1 and Site2 have the same ip address as my main site. When I type ‘http://site1′ into the browser, it goes to my web host and hits my default folder. There it finds the .htaccess file and reads it. It finds an entry matching ‘site1′ which tells it to go into the ‘blog-one’ folder for content. You can replace ‘site1′ for any url name you like, as long as the ip address points to your hosting server.
If you have edited ‘wp-config.php’ correctly, when you browse to http://site1, you should get the WordPress setup screen as shown below.

Fill in your values for site name, email contact etc. etc., the install will complete and you will be given the login details for the admin account.
You should now be able to logon to the site and it should look something like this.

Now you can repeat the steps for ‘http://site2′. If all goes well, you should have a second seperate blog site like below.

And if we look at the tables in our MySQL databse we see they all have wp_1_ and wp_two_ prefixes as shown below, isolating each site in the DB.

You can repeat this multiple times to suit your needs, as long as you can point the DNS for the url to your hosting server it should work fine.
Enjoy :o)