如何修复我的 MySQL 服务器
我使用本地 Apache 服务器来做很多事情,但我从未真正使用过 MySql。我最近决定保留 WordPress 的本地副本,因此我安装了 MySql。
我尝试安装 PHPMYADMIN,但每次尝试登录时都会出现空白屏幕。我尝试了好的和坏的凭据,甚至配置模式。我什至在不使用安装脚本的情况下做了同样的事情。当我放弃PHPMYADMIN时,我只是使用控制台制作数据库,效果很好。当我输入wordpress自动制作安装文件的所有信息时,我也得到了一个空白屏幕。
我从未手动输入过 WordPress 的信息,因为我创建了一个如下所示的 php 文档来测试它(感谢 W3 SCHOOLS http://www.w3schools.com/php/php_mysql_create.asp ) 所有我不想让你看到的信息都已被替换。
<?php
$con = mysql_connect("localhost","USERNAME","PASSWORD");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE DATABASE test_databse",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}
mysql_close($con);
?>
我收到以下错误消息。
Warning: mysql_connect(): [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 2
Warning: mysql_connect(): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 2
Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 2
我检查以确保 MySql 正在作为服务运行(确实如此)
I use a local Apache server for many things, but I never really had a use for MySql. I recently decided to keep a local copy of Wordpress, so I installed MySql.
I tried to install PHPMYADMIN, but every time I tried to log on I got a blank screen. I tried with good and bad credentials and even the CONFIG mode. I even did the same thing without using the install script. When I gave up on PHPMYADMIN, I just used the console to make the database, which worked fine. When I put in all the information for wordpress to automatically make the setup file, I also got a blank screen.
I never entered the information for wordpress manually because I created a php document that looked like the one below to test it (Thanks to W3 SCHOOLS http://www.w3schools.com/php/php_mysql_create.asp ) All information I do not want you to see has been replaced.
<?php
$con = mysql_connect("localhost","USERNAME","PASSWORD");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE DATABASE test_databse",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}
mysql_close($con);
?>
I got the following error message.
Warning: mysql_connect(): [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 2
Warning: mysql_connect(): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 2
Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 2
I checked to make sure MySql was running as a service (which it was)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要检查您的 my.cnf
此设置应该在那里:
并且请检查您的 Windows 防火墙 - 或个人防火墙(如果有)。
可以在这里找到一个在 Windows 上启动 apache、php 和 mysql 的好包: http:// /www.apachefriends.org/en/xampp.html
You need to check your my.cnf
This settings should be there:
And please check your Windows Firewall - or Personal Firewall if there is one.
And a good package to start with apache, php and mysql on Windows can be found here: http://www.apachefriends.org/en/xampp.html
使用管理权限打开记事本
在记事本中打开您的主机文件,该文件应位于
c:\Windows\System32\drivers\etc\hosts
或类似位置您可能需要在记事本的“打开”窗口中将文件类型从文本文档 (.txt) 更改为所有文件 (.*) 注释掉该行
Open notepad with administrative privileges by
In notepad open your hosts file, which should be located in
c:\Windows\System32\drivers\etc\hosts
or somewhere similarYou may need to change the file types from Text Documents (.txt) to All Files (.*) in the Open window in notepad Comment out the line