我有 2 个不同的虚拟主机(pagodabox& 000webhost,都是免费的),并且我localhost用 MySQL 设置了一个。
我已经在他们三个都安装了wordpress,它们在他们自己的域中工作得很好——即。当localhostwordpress正在使用localhost数据库时,pagodabox正在使用pagodabox数据库等等。
但是,如果我更改数据库访问凭据wp-config.php以使localhostwordpress 连接到000webhost数据库,则它不起作用:"Error establishing database".
这是我使用的相应凭据:
<?php
wp-config.php - relevant differences
* members.000webhost.com/panel/Manage MySQL Databases
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', '--------_db');
/** MySQL database username */
define('DB_USER', '--------');
/** MySQL database password */
define('DB_PASSWORD', '--------');
/** MySQL hostname */
define('DB_HOST', 'mysq--.000webhost.com');
* tunnel.pagodabox.com
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', '--------_db');
/** MySQL database username */
define('DB_USER', '--------');
/** MySQL database password */
define('DB_PASSWORD', '--------');
/** MySQL hostname */
define('DB_HOST', 'tunnel.pagodabox.com');
* localhost
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', '--------_db');
/** MySQL database username */
define('DB_USER', '--------');
/** MySQL database password */
define('DB_PASSWORD', '--------');
/** MySQL hostname */
define('DB_HOST', 'localhost');
?>
