systemctl status mysqld
mysql -u root -p
cat /var/log/mysqld.log | grep localhost //如果第一次登录密码不知道,使用此语言查看密码
2.修改加密规则以及重置本地登录密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456' PASSWORD EXPIRE NEVER;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
flush privileges;
3.添加User,授权可远程访问并设置密码
create user 'ticket'@'%' identified with mysql_native_password by '1234';
grant all on *.* to 'ticket'@'%';
flush privileges;
4.查看用户信息是否添加成功
select host,user,plugin,authentication_string from mysql.user;