不用密码在xampp中连接mysql

2022-01-14 00:00:00 xampp php mysql

我想将mysql xampp密码配置为无密码.我打开了my.ini,看到下面一行:

I want to configure the mysql xampp password to no password. I opened the my.ini and I saw the following line:

# password       = password

我不使用密码我应该输入什么?

I I don't use password what should I type?

这就是我尝试通过 php 连接到 mysql 时遇到的错误:

And that's the error I get when I try to connect to mysql through php:

 mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using     
password: YES) in C:xampphtdocsspikesfunctions.php on line 53
Failed to connect to MySQL: Access denied for user 'root'@'localhost' (using password: YES)
Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in     
C:xampphtdocsspikeshome.php on line 6

推荐答案

如果你没有设置 MySQL 的密码(通过 XAMPP 打开 MySQL 配置检查),只需输入"作为密码.确保您的 PHP 脚本也配置为使用它作为密码,因为它当前正在尝试使用一个(因此使用密码:YES).

If you haven't set a password for MySQL (check by opening the MySQL config through XAMPP), just put "" as the password. Make sure your PHP script is also configured to use that as the password, because it is currently trying to use one (hence the Using password: YES).

相关文章