How can I change the character set for MySQL to utf8?
To set the MySQL character set to utf8, you can follow these steps:
- Open the configuration file my.cnf for MySQL. You can find the my.ini file in the installation directory on Windows, and usually in /etc/mysql/my.cnf or /etc.cnf on Linux.
- Add or modify the following lines in the [mysqld] section:
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
This will set the default character set for the MySQL server to utf8, and use utf8_general_ci collation.
- Save and close the configuration file.
- Restart the MySQL service.
After completing the above steps, the character set of the MySQL server will be set to utf8.