1.修改配置信息:

vim /etc/mysql/mysql.conf.d/mysqld.conf
修改如下信息:
[mysqld]
skip-grant-tables
保存

2.登录mysql客户端:

mysql -uroot -p 回车

3.修改密码:

update mysql.user set authentication_string=password("新密码") where user="root";

4.增加用户和权限:

GRANT ALL PRIVILEGES ON *.* TO pk_mysql@"%" IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;

5.编辑配置文件,把skip-grant-tables注释掉


知秋
1 声望0 粉丝