Home >CMS Tutorial >WordPress >wordpress multiple sites use one database

wordpress multiple sites use one database

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-07-20 09:46:022935browse

wordpress multiple sites use one database

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:

wordpress multiple sites use one database

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn