执行如下脚本保存至.sh文件,并使用chmod +x 改变文件的属性,并执行改脚本
#!/usr/bin/bash
echo “skip-grant-tables”>>/etc/my.cnf
systemctl restart mysqld
mysql -e “select user,host,authentication_string from mysql.user where user=‘root’”
mysql -e “update mysql.user set authentication_string=’’ where user=‘root’”
sed -i ‘s/skip-grant-tables//g’ /etc/my.cnf
systemctl restart mysqld
mysqladmin -uroot password ‘Admin@1234’
echo “password is : Admin@1234”
linux忘记mysql密码解决方法
最新推荐文章于 2024-04-27 11:13:19 发布