简体   繁体   English

如何修复在“ localhost / wordpress”上建立数据库连接时出错

[英]How to fix Error establishing a database connection on “localhost/wordpress”

I had downloaded XAMPP software for wordpress. 我已经为Wordpress下载了XAMPP软件。 After downloading, the wordpress started giving Data Base Connection Error when I tried to enter username and password. 下载后,当我尝试输入用户名和密码时,wordpress开始提示数据库连接错误。 So I decided to uninstall XAMPP and downloaded WAMP server. 因此,我决定卸载XAMPP并下载了WAMP服务器。

Now, after downloading it, I am unable to go into localhost/wordpress and it is showing the 'error establishing database connection'. 现在,下载后,我无法进入localhost / wordpress并显示“建立数据库连接错误”。 It's pretty frustrating. 真令人沮丧。

Please help... 请帮忙...

Cheers. 干杯。

You find many tutorials regarding same online . 您可以在网上找到许多关于同一教程。 But my probleam was due to attack on one of my xmlrpc file . 但是我的问题是由于对我的xmlrpc文件之一的攻击。 Just block the ip that is requesting xmlrpc . 只需阻止请求xmlrpc的IP。 Also this was helpful Link 此外,这是有帮助的链接

I think I may have figured this out. 我想我可能已经知道了。 Everytime I start a new build in Wamp I got the error establishing connection to database. 每次我在Wamp中启动新版本时,都会出现建立与数据库连接的错误。 First, establish the database and THEN import the WordPress files. 首先,建立数据库,然后导入WordPress文件。 On the wp-config.php file (which you created by copying the wp-config-sampl.php file and deleting the "-sample" part, enter the name of the database you established here: define('DB_NAME', 'youdatabase'); where it reads 'youdatabase'. 在wp-config.php文件(通过复制wp-config-sampl.php文件并删除“ -sample”部分创建的文件上,输入您在此处建立的数据库的名称: define('DB_NAME','youdatabase ');读取为'youdatabase'的位置。

Since the default username is 'root' and the password is blank, then the username is 'root' where it reads define('DB_USER', 'root'); 由于默认的用户名是“ root”,密码是空白,所以用户名是“ root”,它在其中读取define('DB_USER','root'); and the password line should look like this: define('DB_PASSWORD', ''); 密码行应如下所示: define('DB_PASSWORD','');

Refresh the browser and then you should be led to complete the installation on your local host. 刷新浏览器,然后应指导您完成本地主机上的安装。

This could be the 1200th time that the answer has been posted, but maybe this will help. 这可能是答案发布的第1200次,但这也许会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM