Found the following from the web: $sudo gedit /etc/mysql/my.cnf
Under [client] add.
default-character-set=utf8
Under [mysqld] add.
default-character-set=utf8
Then save and exit
$ /etc/init.d/mysql restart
The result appears:
Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the stop(8) and then start(8) utilities, e.g. stop mysql ; start mysql. The restart(8) utility is also available. start: Job failed to start
It may be a version problem, check the method of modifying the character encoding method for versions after 5.5, and found that the method of modifying [mysqld] has changed to
[mysqld] added under should read.
character-set-server=utf8
collation-server=utf8_general_ci
save and quit
$ /etc/init.d/mysql restart
success
To access the MySQL console.
show variables like 'character%';
+———————————–+———————————–+
| 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/ |
+————————————+———————————–+
8 rows in set (0.00 sec)
Similar Posts:
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
- mysql ERROR 1044 (42000): Access denied for user ‘
- Ultra character map for Mac
- SQLSTATE[HY000]: General error: 1366 Incorrect string value: ‘\xF0\x9F\x91\xBC’
- [Solved] MYSQL ERROR 2003 (HY000): can’t connect to MySQL server (10060)
- [Solved] SyntaxError: unexpected character after line continuation character
- When mysql creates a table, set timestamp DEFAULT NULL error 1067-Invalid default value for’updated_at’
- utf8mb4_general_Ci error reporting solution
- How to Solve MYSQL Error: Can’t create test file xxx lower-test
- How to Solve MySQL Secure file priv error