WordPress has not been installed
Before initially configuring WordPress, change the $table_prefix value in wp-config.php (The default is wp_) Change it to the required table prefix (assumed to be blog_ in this article), and then install it all the way.
Before modification:
The code is as follows:
/** * 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_';
After modification:
The code is as follows:
/** * 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 = 'blog_';
Related recommendations: "WordPress Tutorial"
WordPress has been installed
If WordPress has been installed , then perform the following steps:
1. Modify the $table_prefix value wp_ in wp-config.php to the required table prefix (blog_).
2. Modify the corresponding table prefixes in the MySQL database to the new table prefix, as shown below:
3. Perform the following database update (please Modify the table prefix accordingly):
The code is as follows:
UPDATE blog_usermeta SET meta_key ='blog_capabilities' WHERE meta_key ='wp_capabilities'; UPDATE blog_usermeta SET meta_key ='blog_user_level' WHERE meta_key ='wp_user_level'; UPDATE blog_options SET option_name='blog_user_roles' WHERE option_name='wp_user_roles';
The above is the detailed content of wordpress multiple sites use one database. For more information, please follow other related articles on the PHP Chinese website!