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?

hraphrap
  • 237
  • 2
  • 16
  • 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 05:32

0 Answers0