linux下Mysql配置

vi /etc/my.cnf mysql配置

在[mysqld]的段中加上一句:skip-grant-tables 跳过密码验证

保存::wq!

service mysqld start 启动mysql

UPDATE user SET Password = password ( ‘new-password’ ) WHERE User = ‘root’ ;
(备注:mysql5.7以上修改密码语句:update mysql.user set authentication_string=password(‘123qwe’) where user=‘root’ and Host = ‘localhost’;)
更改mysql密码
将刚才在[mysqld]的段中加上的skip-grant-tables删除
此时重启mysql
service mysqld restart
密码生效

猜你喜欢

转载自blog.csdn.net/abcafdsgr123456789/article/details/90060481