To insert data to MySQL in Ubuntu, follow these steps: 1. stop MySQL service: sudo/etc/init. d/mysqlstop2. edit the MySQL configuration file: sudogedit/etc/mysql/my. cnf3. add default-character-set = utf84 to [client], [mysqld_safe], [mysql], and other segments
To insert data to MySQL in Ubuntu, follow these steps:
1. stop MySQL service: sudo/etc/init. d/mysql stop
2. Edit the MySQL configuration file: sudo gedit/etc/mysql/my. cnf
3. Add default-character-set = utf8 to [client], [mysqld_safe], [mysql], and other segments.
4. Restart the MySQL service: sudo/etc/init. d/mysql start
Related reading: An error occurred while inserting Chinese Characters in Ubuntu MySQL.
Detection:
Enter mysql and enter mysql> show variables like '% char % ';
-------------------------------------------
| Variable_name | Value
--------------------------------------------
| Character_set_client | utf8
| Character_set_connection | utf8
| Character_set_database | utf8
| Character_set_filesystem | binary
| Character_set_results | utf8
| Character_set_server | utf8
| Character_set_system | utf8
| Character_sets_dir |/usr/share/mysql/charsets/
If the preceding result is displayed, the configuration is successful.