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.
这是我知道的
- 数据库存在,我可以在 phpMyAdmin 中对它 运行 SQL 命令。
- 我的用户是root
- 主机是本地主机
- 数据库是lynda_under17_040518
- root 拥有对数据库的所有权限(已在 phpMyAdmin 中验证)
- 同一 WAMPServer 上的其他本地网站工作正常
This Stack Overflow post 说把 define( 'WP_DEBUG_LOG', true );
放在 wp-config.php 中,我已经完成了。它还说:
“the debug.log file will be in wp-content.”
即使我重新启动了 WAMP 中的所有服务并刷新了浏览器,我也没有看到任何调试日志。
我查阅的其他链接
我查看了这些页面上的信息,但它们对我的情况并没有真正帮助。
- can't select database wordpress error
- Can't select database - Wordpress
- https://acloud.guru/forums/aws-certified-solutions-architect-associate/discussion/-KP4_87InltfL9P6rf-J/cant-select-database-wordpress-error
- https://chartio.com/resources/tutorials/how-to-grant-all-privileges-on-a-database-in-mysql/
- https://serverfault.com/questions/263868/how-to-know-all-the-users-that-can-access-a-database-mysql/263936
我的调试日志在哪里以及如何获取我的本地网站运行ning?
尽管 SQL 及其同类产品允许使用很长的数据库名称,但许多应用程序(例如 cPanel)只能识别 16 个或更少字符的数据库名称。我怀疑您的数据库名称 (lynda_under17_040518) 太长了,WAMP and/or WordPress 无法识别,如果缩短数据库名称,它将正常工作。
在我的例子中,我使用的是备用端口(不是 3306),所以我必须遵循以下说明:
https://codex.wordpress.org/sk:Editing_wp-config.php#MySQL_Alternate_Port
我正在学习这个 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.
这是我知道的
- 数据库存在,我可以在 phpMyAdmin 中对它 运行 SQL 命令。
- 我的用户是root
- 主机是本地主机
- 数据库是lynda_under17_040518
- root 拥有对数据库的所有权限(已在 phpMyAdmin 中验证)
- 同一 WAMPServer 上的其他本地网站工作正常
This Stack Overflow post 说把 define( 'WP_DEBUG_LOG', true );
放在 wp-config.php 中,我已经完成了。它还说:
“the debug.log file will be in wp-content.”
即使我重新启动了 WAMP 中的所有服务并刷新了浏览器,我也没有看到任何调试日志。
我查阅的其他链接
我查看了这些页面上的信息,但它们对我的情况并没有真正帮助。
- can't select database wordpress error
- Can't select database - Wordpress
- https://acloud.guru/forums/aws-certified-solutions-architect-associate/discussion/-KP4_87InltfL9P6rf-J/cant-select-database-wordpress-error
- https://chartio.com/resources/tutorials/how-to-grant-all-privileges-on-a-database-in-mysql/
- https://serverfault.com/questions/263868/how-to-know-all-the-users-that-can-access-a-database-mysql/263936
我的调试日志在哪里以及如何获取我的本地网站运行ning?
尽管 SQL 及其同类产品允许使用很长的数据库名称,但许多应用程序(例如 cPanel)只能识别 16 个或更少字符的数据库名称。我怀疑您的数据库名称 (lynda_under17_040518) 太长了,WAMP and/or WordPress 无法识别,如果缩短数据库名称,它将正常工作。
在我的例子中,我使用的是备用端口(不是 3306),所以我必须遵循以下说明: https://codex.wordpress.org/sk:Editing_wp-config.php#MySQL_Alternate_Port