要用管理员账号运行。
systemctl start mysql
#启动MySQL服务
mysqld_safe --user=mysql &
#启动MySQL服务(安全方式)
mysql -u root -p
#登录MySQL(有密码)
mysql -u root
#登录MySQL(无密码)
成功进入MySQL。
update mysql.user set authentication_string=password('我的密码') where user='root' and Host = 'localhost';
#修改指定服务端的密码