Home  >  Article  >  Backend Development  >  Is MySQL8.0 version incompatible with PHP7?

Is MySQL8.0 version incompatible with PHP7?

Guanhui
GuanhuiOriginal
2020-06-06 13:58:174859browse

Is MySQL8.0 version incompatible with PHP7?

Incompatibility between MySQL8.0 version and PHP7?

MySQL8.0 version is incompatible with PHP7. There are generally two situations:

1. Mainly because MySQL8.0 defaults to utfmb4 format, and PHP defaults to UTF8 format;

Solution: You need to set the default format of MySQL8.0 to UTF8

Is MySQL8.0 version incompatible with PHP7?

2. Caused by incompatible encryption methods for identity authentication, the default format in MySQL8.0 The method is caching_sha2_password.

Solution:

Just create a new user with the old encryption method and initialize the password:

CREATEUSERusername@localhostidentifiedwithmysql_native_passwordby'password';

Then add a line in my.cnf:

default_authentication_plugin=mysql_native_password;

Recommended tutorial: "PHP Tutorial"

The above is the detailed content of Is MySQL8.0 version incompatible with PHP7?. 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