![](/img/trans.png)
[英]Migrate WordPress Multisite from localhost to public hosting (Error establishing a database connection
[英]Wordpress Multisite “Error establishing a database connection” issue
我研究了很多的#2问题像这样 ,和网,但没有解决我的问题。
我在域X上的多站点工作正常。 现在,我将其所有DB URL Replace移至我的服务器。 我也相应地更改了wp-config
和htaccess
。
问题是当我设置define('MULTISITE', false);
如果为false
则仅运行基础站点,对于其他子站点,则显示404
错误。
但我多点,我刚搬到我的实例,并且必须具有MULTISITE
作为true
的多点工作。
现在,当我将其设置为true时,我得到
建立数据库连接时出错
错误。 我不知道到底发生了什么。 我调试了但无法解决。
我的多站点配置代码
/* Multisite */
define('WP_ALLOW_REPAIR', true);
define('MULTISITE', true);
define('WP_ALLOW_MULTISITE', true);
//define('RELOCATE',true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'localhost');
$base = '/';
define('PATH_CURRENT_SITE', '/smart_facility_linux/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
//我的Htaccess(没有任何问题)
RewriteEngine On
RewriteBase /smart_facility_linux/
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
#RewriteRule ^privacy-statement.html /privacy-statement [L]
我解决了它并起作用了:)
在wp_blogs
表中,
旧结构是
Domain : localhost/smart_facility_linux
Path : /
但我将其更改为使其工作如下:
对于根站点:
Domain : localhost
Path : /smart_facility_linux/
对于子站点1(主站点下的任何子站点,我都给出了示例):
Domain : localhost
Path : /smart_facility_linux/subsite1/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.