#日志中查看新生成的密码sudocat /var/log/mysql/error.log |grep password#登录MySQL,输入日志中的密码
mysql -uroot-p#修改MySQL密码
ALTER USER'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'you_password';#刷新配置使其生效
FLUSH PRIVILEGES;#查询是否修改成功,lower_case_table_names = 1则成功select @@lower_case_table_names;
设置MySQL远程连接
#新建用户
CREATE USER'username'@'%' IDENTIFIED BY 'you_password';#授权
GRANT ALL PRIVILEGES ON *.* TO 'robot'@'%' WITH GRANT OPTION;#刷新配置使其生效
FLUSH PRIVILEGES;