# mysql5.6 直接登录没有密码
use mysql;
update user set password=password('你的密码') where user='root';
# mysql5.7 登录
grep "password" /var/log/mysqld.log #查看临时密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '你的密码'; #必须8位以上大小写字母和数字
# 修改远程登录
GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "你的密码";
flush privileges;
exit;