一、可以成功登錄到MySQL中
1 使用具有數據庫管理權限的用戶登陸MySQL,如root用戶
$ mysql -uroot -p'root_password'
2 在mysql中創建用戶名和密碼
mysql> create user 'new_username'@'%' IDENTIFIED BY 'new_password';
3 配置權限
mysql> grant all privileges on *.* TO 'new_username'@'%' with grant option;
4 提交並立即生效
mysql> commit;
mysql> flush privileges;
5 退出mysql
mysql> quit
完成
二、不能登錄到MySQL中
1 執行vim /etc/my.cnf命令
2 屏蔽default_authentication_plugin=mysql_native_password語句
3 添加skip-grant-tables(跳過密碼驗證)