1. 停止mysql服务 /etc/init.d/mysql stop
2. 在终端输入 /usr/local/mysql/bin/mysqld_safe --skip-grant-tables --user=root 此时mysql以跳过检测的模式运行
3. 打开另一个终端
输入 mysql -uroot 进入mysql ,
mysql> update mysql.user set Password=PASSWORD('密码') where user = 'root';
mysql> FLUSH PRIVILEGES;
4. 退出mysql
5. 启动mysql服务 /etc/init.d/mysql start
完成。
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn