![]() | |
| mariadb and mysql logo, most popular dbms |
Below is the PHP error occured when developing PHP apps using upgraded version MySQL 8, before that I used MySQL 5.
This PHP error happens after i upgrade MySQL version from 5 to 8, it happens because the utf8 is being replaced by utf8mb4. So if you use this SQL queries, you will see what the default charset is being used by MySQL:
In MySQL version 8, it showing something character_set_server | utf8mb4.
So the easiest way to solve this problem is to change it back the way it is before, to change it to utf8. So heres the query to change it back from utf8mb4 to utf8.
You can change the character set by putting or changing this in your my.ini:
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8
Save my.ini and restart MySQL service. My.ini can be located in these one of possible location:
- %PROGRAMDATA%\MySQL\MySQL Server 5.7\my.ini,
- %PROGRAMDATA%\MySQL\MySQL Server 5.7\my.cnf
- %WINDIR%\my.ini
- %WINDIR%\my.cnf
- C:\my.ini, C:\my.cnf
- INSTALLDIR\my.ini
- INSTALLDIR\my.cnf
Join the discussion
We welcome thoughtful feedback and questions.
Sign in to comment
Use your account to join the conversation, or create one in seconds.
Log in to your account
Create your reader account
Commenting as