In most WordPress database default installations, one database is good for one WordPress website. And as said earlier, launching another WordPress website requires the developer to create another database if this is allowed, but it can be restricted by some web hosts (such restrictions are mostly associated with free hosting accounts).
In this case, a single allowable MySQL database is not utilized to the fullest (to be used by more than one WordPress-powered website). However, the creator of WordPress allows website developers to use only one MySQL database for more than one WordPress website. This is not commonly done, but is a very efficient way to use your MySQL database.
In the procedure described below, it is assumed that the first WordPress website has been completely launched and set up using the original, single MySQL database.
You are going to use the same database to create another WordPress.
Step 1: Open the wp-config.php of the new WordPress website (to be set up) using your favorite PHP editor.
Step 2: Find the following details below and enter the MySQL database access information:
// ** MySQL settings - You can get this info from your web host ** //
/** Enter the same WordPress database name you use with the other WordPress websites */
define('DB_NAME', 'Yourwordpressdatabasename');
/** MySQL database username of the database you use above */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'XXXXX');
/** MySQL hostname */
define('DB_HOST', 'localhost');
Okay, once the above parameters are changed, look for this line in your wp-config.php file and change the table prefix name to a new one:
/**
* 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! The prefix below should not be the same as the one you've used before
*/
$table_prefix = 'codexmwordpresspart2_';
Once the wp-config.php changes have been completed, proceed with the WordPress installation (for the second website). And then, when you look at the MySQL database, you will see that a new set of 10 MySQL database tables has been created, in addition to the previous tables. See the screen shot below:
Inside the red box are the tables from the original/first WordPress website database tables. The yellow box contains the tables created for the second, new website.