windows/liunx版本:mysql-8.0.27参考官网文档: https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html 一.windows下mysql密码重置1.停止mysql服务(启动状态下)net stop MySql 2.新建一个文件夹D盘下mysql-init.txt,放入如下语句(包含新密码:MyNewPass): ALTER USER 'root'@'localhost' IDENTIFIED BY
1,修改/etc/my.cnf添加添加skip-grant参数,重启mysql. 2,登录mysql mysql -uroot 3, 更新user中root的密码 use mysql; update user set password=password ('npasswd') where user='root' 4,将/etc/my.cnf 中的skip-grant取消掉,重启mysql,使用新密码登录查看是否OK.
windows平台下,5.7版本mysql,破解密码的两种方式: #1 关闭mysql服务net stop mysql 启动mysql服务 跳过权限 #2 在cmd中执行:mysqld --skip-grant-tables 另开一个cmd #3 在cmd中执行:mysql 之前账号有密码的 不输入密码 可以进去 C:\Users\Administrator.QH-20170325TNQR>mysql -uroot -p Enter password: Welcome to the MySQL
安装mysql步骤:1.yum install mysql-server -y2.service mysqld start3.mysql4.切换数据库 use mysql 查看表 show tables 查看表的数据 select host,user,password from user; 增加数据 grant all privileges on *.* to 'root'@'%' identified by '123' with grant option delete from user wh