mysql 重置密码,跳过登录修改密码:
# centos 7 上mysql 已经改名了,启动服务的时候注意是mariadb 了!!!!! # 1 systemctl stop mariadb # 2 systemctl set-environment MYSQLD_OPTS="--skip-grant-tables" # 3 systemctl start mysqld # 4 直接登录,无密码 mysql -u root # 5 update user set password=password("new_password") where user='root'; # 6 FLUSH PRIVILEGES; # 7 quit #8 systemctl stop mariadb #9 systemctl unset-environment MYSQLD_OPTS #10 systemctl start mysqld #11 mysql -u root -p