PHP Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in /usr/local/php/CreateDB.php on line 5

PHP Warning:  mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in /usr/local/php/CreateDB.php on line 5

原因:php还不支持mysql8.0最新的密码加密方式

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1'; #将密码改为password形式的密码即可