WAMP 服务器上的 WordPress localhost 中无法 select 数据库错误

Can't select database error in WordPress localhost on WAMP Server

我正在学习这个 Lynda.com 教程(WordPress – 使用下划线从头开始构建主题(2017))并且还没有走多远。我使用 WAMP Server 在本地主机上安装了一个空白的 WordPress 安装,我下载并安装了下划线主题。但是由于某种原因,当我尝试启动网站时出现此错误:

Can’t select database

We were able to connect to the database server (which means your username and password is okay) but not able to select the lynda_under17_040518 database.

Are you sure it exists?

Does the user root have permission to use the lynda_under17_040518 database? On some systems the name of your database is prefixed with your username, so it would be like username_lynda_under17_040518. Could that be the problem?

If you don’t know how to set up a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.

这是我知道的

This Stack Overflow post 说把 define( 'WP_DEBUG_LOG', true ); 放在 wp-config.php 中,我已经完成了。它还说:

“the debug.log file will be in wp-content.”

即使我重新启动了 WAMP 中的所有服务并刷新了浏览器,我也没有看到任何调试日志。

我查阅的其他链接

我查看了这些页面上的信息,但它们对我的情况并没有真正帮助。

我的调试日志在哪里以及如何获取我的本地网站运行ning?

尽管 SQL 及其同类产品允许使用很长的数据库名称,但许多应用程序(例如 cPanel)只能识别 16 个或更少字符的数据库名称。我怀疑您的数据库名称 (lynda_under17_040518) 太长了,WAMP and/or WordPress 无法识别,如果缩短数据库名称,它将正常工作。

在我的例子中,我使用的是备用端口(不是 3306),所以我必须遵循以下说明: https://codex.wordpress.org/sk:Editing_wp-config.php#MySQL_Alternate_Port