我刚刚清空了我的 Mac 然后重新安装了一个 El Capitan。我现在正在努力连接 Mysql。在完成了 Web 服务器设置过程之后,我创建了一个简单的 PHP 测试文件:
<?php
$conn = new mysqli("127.0.0.1", "root", "xxxxxxxx");
if ($conn->connect_error) echo "Connection failed: " . $conn->connect_error;
else echo "Connected successfully";
phpinfo();
?>
当我运行它时,我得到这个错误:
Warning: mysqli::mysqli(): (HY000/1862): Your password has expired. To log in you must change it using a client that supports expired passwords. in /Users/rich/Documents/DESIGN/test/index.php on line 3
Connection failed: Your password has expired. To log in you must change it using a client that supports expired passwords.
我从来没有见过这样的反应,如果我不能连接,我该怎么修复它?
剪辑
在终端我输入了命令:
mysql -u root -p
这要求我输入我的密码(当前密码)。我现在可以访问 mysql 命令,但是我尝试的任何操作都会导致这个错误:
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
如何使用 ALTER USER
重置密码?