Home  >  Article  >  Backend Development  >  mysql8 and php7 cannot connect

mysql8 and php7 cannot connect

王林
王林Original
2019-10-16 16:51:273837browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn