为我的本地主机wordpress使用在线数据库



我必须与朋友一起在wordpress项目中工作,我们希望能够在localhost中从我们这边工作。为此,我们使用 git 来使用相同的代码,但我们需要使用相同的数据库。我在网上创建了一个数据库:

https://xxxx.xxxxxx.com/phpmyadmin

我编辑我的 wp-conf 文件有这样的东西:

define( 'DB_NAME', 'db_name' );
define( 'DB_USER', 'admin' );
define( 'DB_PASSWORD', '******' );
define( 'DB_HOST', 'https://xxxx.xxxxxx.com' );

我已经尝试过:

define( 'DB_HOST', 'xxxx.xxxxxx.com/phpmyadmin' );

define( 'DB_HOST', 'http://xxxx.xxxxxx.com' );

define( 'DB_HOST', 'http://xxxx.xxxxxx.com/phpmyadmin' );

等。。。

谢谢

本杰明。

如果您参考此处的法典 https://codex.wordpress.org/Editing_wp-config.php 设置DB_HOST

格式应为

define( 'DB_HOST', 'the_ip_of_the_server' );

或者在某些情况下,如果您需要设置端口。

define( 'DB_HOST', 'mysql.example.com:3307' );
If your host uses Unix sockets or pipes, adjust the DB_HOST value in the wp-config.php file accordingly.
define( 'DB_HOST', '127.0.0.1:/var/run/mysqld/mysqld.sock' );
// or define( 'DB_HOST', 'localhost:/var/run/mysqld/mysqld.sock' );
// or define( 'DB_HOST', 'example.tld:/var/run/mysqld/mysqld.sock' );

要解决此问题: 我只是将数据库公开。