1

I have installed mysql 5.6 on debian 7.10 from official mysql deb repository:

deb http://repo.mysql.com/apt/debian/ wheezy mysql-5.6

So i have these packages installed:

# dpkg -l | grep mysql | awk '{print $2 " " $3}' | column -t
libdbd-mysql-perl       4.021-1+b1
libmysqlclient18:amd64  5.6.30-1debian7
mysql-apt-config        0.7.2-1
mysql-client            5.6.30-1debian7
mysql-common            5.6.30-1debian7
mysql-community-client  5.6.30-1debian7
mysql-community-server  5.6.30-1debian7
mysql-server            5.6.30-1debian7

I have cp1251 locale installed on my system:

# locale -a
ru_RU.cp1251

# echo $LANG
ru_RU.cp1251

And, my database and connection to it was configured properly:

# mysql
Server version: 5.6.30-log MySQL Community Server (GPL)
(none)>show variables like 'char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | cp1251                     |
| character_set_connection | cp1251                     |
| character_set_database   | cp1251                     |
| character_set_filesystem | binary                     |
| character_set_results    | cp1251                     |
| character_set_server     | cp1251                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0,00 sec)

And for sure my putty connection was configured to use cp1251 encoding.

But console client mysql from package mysql-client=5.6.30-1debian7 does not display anything while I'm typing non-latin (non-ascii) symbols (characters). So, for example, I can execute SELECT statement, and it's result displays correctly:

# mysql database
Server version: 5.6.30-log MySQL Community Server (GPL)
database> SELECT label FROM users LIMIT 1;
+----------------+
| label          |
+----------------+
| админ          |
+----------------+
1 row in set (0,00 sec)

But when I type statement "SELECT label FROM users WHERE label='админ';" like that:

database> SELECT label FROM users WHERE label='';
+----------------+
| label          |
+----------------+
| админ          |
+----------------+
1 row in set (0,00 sec)

It eats string админ, hiding it from my eyes, when I type it, but they are still there, so request ended with correct result.

How to fix it?

  • Try adding a .my.cnf file in your home directory and add the lines [mysql] default-character-set=cp1251 – wurtel May 19 '16 at 14:52
  • @wurtel Thank you! I have tried that solution, but no result =( As i know, default-character-set=cp1251 is equivalent of set names cp1251 instruction, that instruction works as expected, cyrillic symbols in queries results are displayed properly. – hraphrap May 25 '16 at 12:12
  • Does echo админ from debian console (before connecting to mySql client) work? – JosefZ Jun 20 '16 at 22:20
  • @JosefZ Yes, it does! I think, something wrong with library for input/output interacting with console, that this version of mysql client use. For example, i don't see any libreadline.so in ldd /usr/bin/mysql output. And while stracing when i type cyrillic symbols I see read calls but no write calls (that happens when i'm typing latin symbols) – hraphrap Jun 22 '16 at 5:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.