Get the App
SLTechnology News&Howtos  ›  Database  › 

How to solve the problem of mysql5.5 character set

Shulou Source: shulou.com Published: 2022-05-31 18:48:39 10月05日 Update

This article introduces the relevant knowledge of "how to solve the problem of mysql5.5 character set". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

A 5.5 version is installed, and there is a problem with the character set. The previous mysql servers can be configured in the my.cnf configuration file, but today they cannot report errors all the time:

At that time, the error log was not configured in the system, so we can only configure the location of the error log first to see what went wrong:

[html]

User = mysql

Pid-file = / var/run/mysqld/mysqld.pid

Socket = / var/run/mysqld/mysqld.sock

Port = 3306 www.2cto.com

Basedir = / usr

Datadir = / var/lib/mysql

Tmpdir = / tmp

Log-error=/var/log/mysql/error.log

Lc-messages-dir = / usr/share/mysql

Skip-external-locking

Default-character-set=utf8

As a result, I looked at the error log and found that it was an error in the character set:

[html]

[ERROR] / usr/sbin/mysqld: unknown variable 'default-character-set=utf8'

Unexpectedly do not know, the Internet looked for the next found that some people encountered, said that 5. 5 in the mysql no longer use default-character-set this way of writing.

For details, please see: http://dev.mysql.com/doc/refman/5.5/en/server-options.html#option_mysqld_default-character-set

Just change default-character-set=utf8 to: character-set-server=utf8.

[html]

Root@chenDBA:/etc/mysql# vim my.cnf

Root@chenDBA:/etc/mysql# service mysql start

Mysql start/running, process 5904

Root@chenDBA:/etc/mysql# mysql-uroot-p

Enter password: www.2cto.com

Mysql > 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) OK is done.

This is the end of the content of "how to solve the problem of mysql5.5 character set". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Character character set error configuration problem log content more knowledge no practical successful next location writing dilemma reality situation file article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Huawei macOS Docker Linux