登录
首页 >  数据库 >  MySQL

如何在 Linux 上重置 MySQL 密码?

来源:亿速云

时间:2023-05-02 21:44:23 396浏览 收藏

本篇文章给大家分享《如何在 Linux 上重置 MySQL 密码?》,覆盖了数据库的常见基础知识,其实一个语言的全部知识点一篇文章是不可能说完的,但希望通过这些问题,让读者对自己的掌握程度有一定的认识(B 数),从而弥补自己的不足,更好的掌握它。

初始密码为空,使用空密码登陆mysql执行下列语句

mysql>use mysql;
mysql> update user set password=password("root") where user='root';
mysql> flush privileges;
mysql> quit;
修改/opt/lampp/phpmyadmin/config.inc.php

找到如下代码:

$cfg['servers'][$i]['auth_type'] = 'config';
$cfg['servers'][$i]['user'] = 'root';
$cfg['servers'][$i]['password'] = '';
$cfg['servers'][$i]['extension'] = 'mysql';
$cfg['servers'][$i]['allownopassword'] = true;

修改为:

$cfg['servers'][$i]['auth_type'] = 'config';
$cfg['servers'][$i]['user'] = 'root';
$cfg['servers'][$i]['password'] = 'root';
$cfg['servers'][$i]['extension'] = 'mysql';
$cfg['servers'][$i]['allownopassword'] = true;

以上就是《如何在 Linux 上重置 MySQL 密码?》的详细内容,更多关于mysql,Linux的资料请关注golang学习网公众号!

声明:本文转载于:亿速云 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>