如何修复我的 MySQL 服务器

发布于 2024-09-10 12:58:32 字数 1553 浏览 4 评论 0原文

我使用本地 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夕嗳→ 2024-09-17 12:58:32

您需要检查您的 my.cnf

此设置应该在那里:

[mysqld]
port            = 3306
# Local access only
bind-address           = 127.0.0.1

并且请检查您的 Windows 防火墙 - 或个人防火墙(如果有)。

可以在这里找到一个在 Windows 上启动 apache、php 和 mysql 的好包: http:// /www.apachefriends.org/en/xampp.html

You need to check your my.cnf

This settings should be there:

[mysqld]
port            = 3306
# Local access only
bind-address           = 127.0.0.1

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

星星的轨迹 2024-09-17 12:58:32

使用管理权限打开记事本

单击“开始”>所有程序>配件

右键单击记事本并选择以​​管理员身份运行

在记事本中打开您的主机文件,该文件应位于 c:\Windows\System32\drivers\etc\hosts 或类似位置
您可能需要在记事本的“打开”窗口中将文件类型从文本文档 (.txt) 更改为所有文件 (.*) 注释掉该行

127.0.0.1本地主机

Open notepad with administrative privileges by

clicking Start > All Programs > Accessories

Right click Notepad and select Run as administrator

In notepad open your hosts file, which should be located in c:\Windows\System32\drivers\etc\hosts or somewhere similar
You may need to change the file types from Text Documents (.txt) to All Files (.*) in the Open window in notepad Comment out the line

127.0.0.1 localhost

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文