mac下安装
下载mysql.dmg后安装
用临时密码登陆mysql
修改临时密码
update mysql.user set authentication_string=password('root') where user='root' and Host ='localhost';
alter user user() identified by "root";
推出后用新密码登陆即可
修改用户密码
mysqladmin -u用户名 -p原密码 password '新密码‘
破解root用户
让mysql以没有认证机制启动
- 关闭mysql服务
以管理员身份启动cmd,然后输入以下命令
net stop mysql
- 以无认证机制启动mysql
在cmd中输入以下命令
mysqld --skip-grant- tables
3.启动mysql,并修改root用户密码
在新的cmd中输入以下命令
mysql -uroot
查看是否已经进入root用户
mysql>select user();
确认root用户后,修改密码
mysql>update mysql.user set password=password('新密码') where user='root' and host ='localhost'
然后刷新数据
mysql>flush privileges;