Answer the question
In order to leave comments, you need to log in
Cyrillic support in MySQL, how to add?
I'm trying to set up sql server, nothing happens.
set in config file
skip-character-set-client-handshake
character-set-server = utf8
init-connect='SET NAMES utf8'
collation-server=utf8_general_ci
mysql> status;
--------------
mysql Ver 14.14 Distrib 5.7.15, for Linux (x86_64) using EditLine wrapper
Connection id: 7
Current database:
Current user: [email protected]
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.15-0ubuntu0.16.04.1 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 26 min 0 sec
Threads: 5 Questions: 48 Slow queries: 0 Opens: 113 Flush tables: 1 Open tables: 32 Queries per second avg: 0.030
--------------
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/ |
+--------------------------+----------------------------+
8 rows in set (0,01 sec)
mysql> show VARIABLES LIKE '%Coll%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0,00 sec)
mysql> INSERT INTO content (id, html) VALUES ( 2, 'привет');
ERROR 1366 (HY000): Incorrect string value: '\xD0\xBF\xD1\x80\xD0\xB8...' for column 'html' at row 1
Answer the question
In order to leave comments, you need to log in
ALTER TABLE `content` CONVERT TO CHARACTER SET = utf8;
Goodnight.
Make sure that there is one encoding everywhere, do not limit yourself to mysql.
Encoding of the server, files, comparison of tables and table fields, database connection, etc. etc.
In what encoding do you get the text itself before writing it to the database?
Everything must be in the same encoding.
If the text, for example, is in an encoding other than utf8, there may be problems.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question