“我们能够连接到数据库服务器" WordPress中的错误 [英] "We were able to connect to the database server" error in WordPress

查看:97
本文介绍了“我们能够连接到数据库服务器" WordPress中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到答案. 有一个带有生产数据库的生产网站.已备份数据库并还原到开发环境,在该环境中,我还为两个数据库在同一服务器,相同cPanel,相同用户和相同密码下创建了一个开发网站.是Magento平台1.9.2,尽管我认为并不重要.问题是这样的:我可以在开发数据库中执行SQL,但是在生产数据库中不会执行相同的SQL语句.另外,我已经将WP上传到开发中,并且使用了开发数据库进行magento安装,但是我尝试为生产站点运行WP安装时,WP回答我们能够连接到数据库服务器". 两个数据库的远程MySQL,防火墙等相同,这可能是什么原因,如何解决?谢谢.

I could not find an answer. Have a production website with production DB. Have backed up the DB and restored to a development environment where I also created a development website in the same server, same cPanel, same user and same password for both DBs. Is a Magento platform 1.9.2, although I do not think is important. Here is the issue: I can execute SQL in the development DB but the same SQL sentence would not execute in the production DB. Also I have uploaded WP to the development and isntalled using the development db for the magento installation, but when I try to run the WP installation for the production site, WP replies "We were able to connect to the database server". Remote MySQL, firewall, etc are the same for both DB, what could be the cause of this and how do I solve it? Thank you.

推荐答案

错误We were able to connect to the database server表示WP 可以连接到数据库,但是用户或密码或权限错误.

The error We were able to connect to the database server means WP can connect to the database, but the user or password or permissions are wrong.

您确定wp-config.php中的数据库用户对数据库具有足够的权限吗?尝试为用户赋予所有特权,即数据库的SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER,CREATE TEMPORARY TABLES.

Are you sure database user in wp-config.php has adequate permissions for the database? Try giving the user all privileges, i.e. SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES for the database.

然后,尝试WP_DEBUG查找可能表明其他连接问题的任何php错误.

And, try WP_DEBUG to find any php errors that may indicate other connection issues.

添加

define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true );

define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true );

和debug.log文件将在wp-content中.

in wp-config.php and the debug.log file will be in wp-content.

并且可以选择添加

define( 'WP_DEBUG_DISPLAY', true);

将wp-config.php登录并转储到浏览器中.

to wp-config.php to log and dump them to the browser.

请参见 https://codex.wordpress.org/WP_DEBUG

这篇关于“我们能够连接到数据库服务器" WordPress中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆