当数据库root密码忘记或者安装数据库时默认密码太繁琐。推荐使用如下方法
第一步:找到mysql的配置文件 my.cnf,mysqld添加 代码 --skip-grant-tables
--skip-grant-tables第二步:登录MySQL
mysql -uroot -p第三步:执行一下语句;update mysql.user set authentication_string='1234' where user='root' and host='%';
update mysql.user set authentication_string='1234' where user='root' and host='%';第四步:刷新 flush privileges
flush privileges最后:重启服务 service mysqld restart
service mysqld restart
搞定
分享时为了更好的节约大家时间。爱分享。爱交流
版权声明:本文为qq_43082131原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。