php windows平台如何在xampp中激活mysql数据库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8322550/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to activate the mysql database in xampp on windows platform?
提问by Akshay Takkar
I've installed XAMPP on my Windows XP. I started the XAMPP control panel and it shows apache and mysql are running.
我已经在 Windows XP 上安装了 XAMPP。我启动了 XAMPP 控制面板,它显示 apache 和 mysql 正在运行。
When I check the status by going to localhost/xampp
it shows:
当我通过去检查状态localhost/xampp
显示:
mysql : deactivated
When I run php files that access the mysql database, it shows the following errors:
当我运行访问 mysql 数据库的 php 文件时,它显示以下错误:
Warning: mysql_connect() [function.mysql-connect]: [2002] No connection could
be made because the target machine actively refused it. (trying to connect
via tcp://localhost:3306) in C:\xampp\htdocs\Elo_algorithm.php on
line 18
I've been through the XAMPP troubleshooting page and FAQ but I don't understand what to do. The XAMPP control panel shows mysql is running, but xampp status shows: deactivated
.
我已经浏览了 XAMPP 故障排除页面和常见问题解答,但我不知道该怎么做。XAMPP 控制面板显示 mysql 正在运行,但 xampp 状态显示:deactivated
。
What is going on here?
这里发生了什么?
采纳答案by Dubas
You should view in the xampp installation the file "\xampp\mysql\data\mysql_error.log".
您应该在 xampp 安装中查看文件“\xampp\mysql\data\mysql_error.log”。
This file contais the error log of MySQL and in it you can detect any problem like por in use.
该文件包含 MySQL 的错误日志,您可以在其中检测任何问题,例如 por in use。
For example, this lines of log show that the port 3306 (the mysql default) is used by another application and can't be accessed.
例如,这行日志显示端口 3306(mysql 默认值)被另一个应用程序使用并且无法访问。
111130 8:39:56 [ERROR] Can't start server: Bind on TCP/IP port: No such file or directory
111130 8:39:56 [ERROR] Do you already have another mysqld server running on port: 3306 ?
111130 8:39:56 [ERROR] Aborting
If all in the MySQL is correct probably the problem is related to the driver in the php application. Currently PHP has two MySQL connector types, the "mysql" and the "mysqli", MySQL "mysql" connector, that use "mysql_" (the method that you are using to connect is mysql_connect) prefixed functions, is used for old MySQL 4 applications and when the MySQL 5.x if is in configured with the "old password" parameter. The "mysqli" is used for the new mysql 5.x versions and in php you must use "mysqli_" prefixed functions like "mysqli_connect.
如果 MySQL 中的所有内容都正确,则问题可能与 php 应用程序中的驱动程序有关。目前PHP有两种MySQL连接器类型,“mysql”和“mysqli”,MySQL“mysql”连接器,使用“mysql _”(你使用的连接方法是mysql_connect)前缀函数,用于旧的MySQL 4应用程序以及当 MySQL 5.x 配置了“旧密码”参数时。“mysqli”用于新的 mysql 5.x 版本,在 php 中你必须使用“ mysqli_”前缀函数,如“mysqli_connect”。
The version used by the lastest versions of xampp is MySQL 5.5 and you require to used the mysqli connector.
最新版本的 xampp 使用的版本是 MySQL 5.5,您需要使用 mysqli 连接器。
回答by stefaDesign
OK I got this issue resolved in my case, hopefully will help you too. Problem was system itself. If you run Vista, Win7, win8 you probably have permission issue. Simple go to XAMPP root and find mysql_start.bat and run it. Immediately after clicking your firewall will appear with message asking for permission. All you have to do is to allow permission (for private networks such a home or work network).
好的,我在我的情况下解决了这个问题,希望也能帮助你。问题是系统本身。如果您运行 Vista、Win7、win8,您可能会遇到权限问题。简单地转到 XAMPP 根目录并找到 mysql_start.bat 并运行它。单击您的防火墙后,将立即显示请求许可的消息。您所要做的就是允许权限(对于家庭或工作网络等专用网络)。
MySQL database ACTIVATED - and that's what matters ;)
MySQL 数据库已激活 - 这才是最重要的 ;)
I hope that helps to all of you who did not get an answer so far. Cheers!
我希望这对到目前为止没有得到答案的所有人有所帮助。干杯!
回答by Manjula
Check whether the value of port variable in the "my.ini" file in your xampp mysql folder is 3306 or 8888
检查你的xampp mysql文件夹中“my.ini”文件中端口变量的值是3306还是8888
回答by David Goslin
i was facing the same problem. I had to run setup-xampp.bat to make it working. By the way I came across a new WAMP stack called AMPPS. It looks quite easier than XAMP. You should try. http://www.ampps.com
我面临同样的问题。我必须运行 setup-xampp.bat 才能让它工作。顺便说一下,我遇到了一个名为 AMPPS 的新 WAMP 堆栈。它看起来比 XAMP 容易得多。你应该试试。http://www.ampps.com
回答by John Albrektson
I could not get XAMPP for Windows (1.7.4 Beta2--I know; ancient) to work on Windows 7 (32 bit) as the MySql would not "activate" or connect to Apache. Just by dumb luck I installed .NET Framework 4.6 for another application and suddenly--Whoopee! It started working!
我无法让 XAMPP for Windows(1.7.4 Beta2--我知道;古老)在 Windows 7(32 位)上工作,因为 MySql 不会“激活”或连接到 Apache。只是运气不好,我为另一个应用程序安装了 .NET Framework 4.6,突然——哎呀!它开始工作了!