2

I have just switched from MySQL to MariaDB and am running into a very silly problem: I cannot enter any extended characters in the database (for example, ö ä or å).

The system is utf8, and I tried switching the keyboard to swedish — works everywhere except for mariadb prompt, and even tried copying and pasting from gucharmap — nothing is pasted at prompt.

Either method worked under MySQL in the past. I looked in MariaDB conf.d, the character_set_system was not set so I changed it to utf8, but that did not help. default-character-set in 50-client.cnf is set to utf8mb4. Any ideas?

System: debian bulseye/sid

Mariadb: Ver 15.1 Distrib 10.5.8-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper

These are the relevant mariadb variables:

| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |

| character_set_results | utf8mb4 |

| character_set_server | utf8mb4 |

| character_set_system | utf8 |

| character_sets_dir | /usr/share/mysql/charsets/ |

| collation_connection | utf8mb4_general_ci |

| collation_database | utf8mb4_general_ci |

| collation_server | utf8mb4_general_ci |

| session_track_system_variables | 
autocommit,character_set_client,character_set_connection,character_set_results,time_zone 

show create table gives

ENGINE=InnoDB AUTO_INCREMENT=1625 DEFAULT CHARSET=utf8mb4

The rest are field definitions, and no collations are set.

Of course, there is a prompt: it is a standard mysql prompt.

I am not sure how to make it clearer. I am at mysql prompt. In the past, typing something like å worked fine, now it shows nothing. When I try to paste the character copied from another utility like gucharmap, nothing is pasted. When I paste "normal" characters (i.e. standard English text) everything works.

Note that the extended characters in database entries created BEFORE the switch show up just fine. Yes, it is all very mysterious.

6
  • 1
    I don't think this is much related to database administration -- there seems to be a bug in the libedit implementation used by MariaDB, particularly the command-line client. See this bug report.
    – mustaccio
    Commented May 15, 2021 at 19:25
  • @mustaccio: Maybe I'm misunderstanding something but this seems to be about an issue with a tool that is a standard part of a major DB product. I'd say that makes the question on topic here. An answer indicating that the problem has (or may have) to do with a known bug would make perfect sense to me too.
    – Andriy M
    Commented May 16, 2021 at 13:27
  • @AndriyM The actual question boils down to "how do I compile mysql with proper readline support" or "where do I find a package where mysql has proper readline support"; still think it's on-topic?
    – mustaccio
    Commented May 16, 2021 at 14:19
  • @mustaccio: The question, on the face of it, is about a database product. What it boils down to – as well as, I'm guessing, what the solution is – might not necessarily have to do with databases per se. However, in this particular scenario – things worked in MySQL but stopped working in MariaDB – I would say that both understanding what the question is about and what the solution should be, need to be part of a database user/admin's knowledge. So I don't see a problem why we can't explain the issue here, on a database-related Q&A site.
    – Andriy M
    Commented May 16, 2021 at 14:42
  • @mustaccio: And if we do close the question here, we should at least suggest where it should be reposted IMHO.
    – Andriy M
    Commented May 16, 2021 at 14:43

1 Answer 1

0

If you are using Windows cmd, you need chcp 65001 before entering mysql/mariadb. Since you are using a Linux variant, terminal may need SET NAMES utf8mb4; from within the mysql/mariadb.

If the columns are not utf8mb4, you will have other problems. Check a table by using SHOW CREATE TABLE tablename;

This provides a rundown on common problems and leads to their solutions: https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.