linux安装的mysql忘记密码改密码
运行命令
ps -ef | grep -i mysql
关闭运行命令
service mysqld stop
修改mysql的配置文件my.conf
打开ftp文件/etc 在文件的[mysqld]标签下添加一句:skip-grant-tables
保存后启动数据库service mysqld start
进入到数据库mysql -u root
use mysql
继续
update mysql.user set authentication_string=password('root_password') where user='root';
root_password替换成你想要的密码
然后再把之前添加在my.cnf skip-grant-tablesf语句删除
quit退出 mysql -u root 就能登录了