【发布时间】:2020-01-04 14:14:27
【问题描述】:
我正在尝试设置本地开发环境。我无法让 wordpress 连接到 mysql。我可以使用以下命令复制错误:
wp core install --url=http://uganda.localhost/ --title="Uganda Aid" --admin_user="Jack" --admin_password="thepassword" --admin_email="JackWinterstein@msf.org"
结果:
Error: Error establishing a database connection. This either means that the username and password information in your `wp-config.php` file is incorrect or we can’t contact the database server at `localhost`. This could mean your host’s database server is down.
我尝试过的事情:
- 查看 wp-config 并确保数据库名称和凭据正确。我可以通过 cli 连接
- 更新了
homebrew.mxcl.mysql.plist以包括 --bind-address=* - 查看了mysql的socket位置:
mysql_config --socketproducef/tmp/mysql.sock - 更新了 php.ini 以反映下面的附件
- 更新了 my.cnf 以反映
bind-address = * - 我使用的是dnsmasq(如https://medium.com/@charlesthk/wordpress-on-os-x-with-nginx-php-mysql-62767a62efc4所示)
环境
Darwin osx10.14,mysql Ver 8.0.17,nginx版本:nginx/1.17.3,Wordpress 5.2.2,PHP 7.3.9
【问题讨论】: