MySQL DB encoding problem
See original GitHub issueSystem information:
- 4.2.0-35-generic #40~14.04.1-Ubuntu
- DBeaver ver. 6.3.4.202002011957
Connection specification:
- MySQL ver. 5.7.19
Describe your question:
Hello,
I have several legacy MySQL databases which are created in latin1 charset but in fact data is stored in UTF8 encoding.
So I have to use “SET NAMES latin1” query each time I connect to these databases, no matter I do it manually or from scripts. After that query everything is alright with encoding.
But in DBeaver I cannot change the encoding using “SET NAMES latin1”.
(by the way, MySQL Workbench shows database contents in proper encoding after “SET NAMES latin1” query)
So the question is: may there be any kind of workaround for this situation?
mysql> select @@character_set_client, @@character_set_results, @@character_set_connection; +------------------------+-------------------------+----------------------------+
| @@character_set_client | @@character_set_results | @@character_set_connection |
+------------------------+-------------------------+----------------------------+
| utf8 | utf8 | utf8 |
+------------------------+-------------------------+----------------------------+
1 row in set (0,00 sec)
mysql> select * from roles limit 3;
+--------+----------+----------------------------------------------------------+
| idrole | rolename | roletitle |
+--------+----------+----------------------------------------------------------+
| 1 | admin | ÐдминиÑтратор |
| 2 | guest | ГоÑÑ‚ÑŒ |
| 3 | default | По умолчанию |
+--------+----------+----------------------------------------------------------+
3 rows in set (0,00 sec)
mysql> SET NAMES latin1;
Query OK, 0 rows affected (0,00 sec)
mysql> select * from roles limit 3;
+--------+----------+----------------------------+
| idrole | rolename | roletitle |
+--------+----------+----------------------------+
| 1 | admin | Администратор |
| 2 | guest | Гость |
| 3 | default | По умолчанию |
+--------+----------+----------------------------+
3 rows in set (0,00 sec)
mysql> SHOW CREATE TABLE roles;
| roles | CREATE TABLE `roles` (
`idrole` int(10) unsigned NOT NULL AUTO_INCREMENT,
`rolename` varchar(45) NOT NULL,
`roletitle` varchar(254) NOT NULL,
PRIMARY KEY (`idrole`),
UNIQUE KEY `rolename` (`rolename`)
) ENGINE=MyISAM AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Character encoding issues in MySQL - Stack Overflow
1 Answer 1 ... Your mySQL data is most likely UTF-8 encoded. ... You need to either specify the correct character set when...
Read more >Debugging Character Set Issues by Example - MySQL
Before you start migrating your data to MySQL 8.0 and Unicode, be sure that your environment and your client agree on the character...
Read more >Why is there a MySQL character encoding issue after ...
I believe there is some character encoding issue at this point. Just in case it wasn't a bad export I imported it locally...
Read more >How to Fix the Collation and Character Set of a MySQL ...
1. Stop Confluence · 2. Edit the <local-home>/confluence.cfg.xml file · 3. Update the following line to add the connectionCollation=utf8mb4_bin parameter to your ...
Read more >MySql encoding problem - can't change to utf-8 - SitePoint
You indicate that the database is set up properly with the database collation and text fields set to utf8_general_ci. And since you can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well, that might be a good idea, at least it will be less confusing, but it doesn’t solve the problem… 😦
Wow guys, I’m work the same job as you but I haven’t got those problem because I’m use DataGrip