简体   繁体   English

XAMPP本地主机问题与MySQL

[英]XAMPP localhost issue with mysql

I am getting this warning in my localhost using XAMPP 我在使用XAMPP的本地主机中收到此警告

Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file in C:\xampp\htdocs\folder\dbconnect.php on line 135

How do I fix this warning and what does it mean? 如何解决此警告,它是什么意思?

go to your xampp folder directory : xampp/htdocs/ xampp/mysql.php 转到您的xampp文件夹目录:xampp / htdocs / xampp / mysql.php

you will find this code on the page: 您将在页面上找到以下代码:

<?php if (@mysql_connect("localhost", "pma", "")) { echo "OK"; } else { echo "NOK"; } ?>

so all you have to do is exchange the whole code with this below: 所以您要做的就是用下面的代码交换整个代码:

<?php if (@mysql_connect("localhost", "pma", "")) { echo "OK"; } else { $err = mysql_errno(); if ((1044 == $err) || (1045 == $err) || (1130 == $err)) { echo "OK"; } else { echo "NOK"; } } ?>

and there you have your error fixed in a jiffy!! 在那里,您已经将您的错误修复为轻巧!!

Log onto your XAMPP's PHPMyAdmin and run the following query inside of PHPMyAdmin 登录到XAMPP的PHPMyAdmin并在PHPMyAdmin中运行以下查询

SET PASSWORD = PASSWORD('your_old_mysql_password')

where your_old_mysql_password should be replaced with your current MySQL password. 其中your_old_mysql_password应该替换为您当前的MySQL密码。

This should fix your problem. 这应该可以解决您的问题。

You can also simply reinstall XAMPP (to another directory if possible), which should guarantee a fix since it's self-contained. 您也可以简单地将XAMPP重新安装(如果可能,请安装到另一个目录),因为它是独立的,因此可以保证已修复。

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

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