Home > Article > Backend Development > mysql8 and php7 cannot connect
mysql8 and php7 cannot connect
Solution:
sudo vim /etc/my.cnf
Add:
[mysqld] default_authentication_plugin=mysql_native_password
Create a new user after modifying the configuration and restarting. You can make its password the same as the root password for subsequent use (this step can also verify whether the configuration is effective. If it is effective, the encrypted string should be as follows root password is different)
Recommended tutorial: mysql tutorial
The above is the detailed content of mysql8 and php7 cannot connect. For more information, please follow other related articles on the PHP Chinese website!