修改my.cnf
vim /etc/my.cnf
加入一行配置,跳过验证,并保存退出:q
[mysqld]
skip-grant-tables
进入mysql
update user set authentication_string=password(‘12345678’) where User=‘root’;
授权远程登录
GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘12345678’ WITH GRANT OPTION;
flush privileges;
重启服务
/etc/init.d/mysqld restart