Unknown collation: 'utf8mb4_0900_ai_ci' #5
-
|
Hi guys, great book. I'm at the last chapter and I'm stuck. I've got the edited schema.sql and data.sql sourced into MariaDB and I can run queries at the MariaDB prompt. When I try to connect using the webapp though I get an error - mysql.connector.errors.DatabaseError: 1273 (HY000): Unknown collation: 'utf8mb4_0900_ai_ci'. I've posed a question on StackOverflow with more information. Have you seen this before or have any ideas how to fix? I've installed mariadb-server via apt, maybe there's more I need to install? Trace: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
|
UPDATE: I just tried a little test with the MariaDB Connector and it worked. Now to see if I can wrangle the book's code to use it. |
Beta Was this translation helpful? Give feedback.
-
|
I've taken a quick look at your stackoverflow page and what I saw there led me to take a look at the docs to the underlying MySQL connector/python library. This page https://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlconnection-set-charset-collation.html caught my eye, especially the syntax. It's appears the Keeping my fingers crossed for you. --Paul. |
Beta Was this translation helpful? Give feedback.
-
|
Following https://mariadb.com/docs/server/connect/programming-languages/python/, first I had to install MariaDB connector, |
Beta Was this translation helpful? Give feedback.
Yes, most likely. I've never seen this error before but - if truth be told - my database interactions tend to be pretty vanilla (with defaults charsets, etc., etc.). My "older"
DBcmcode (developed for - and documented in - the 2nd edition of my book) continued to work for me when I updated everything for the 3rd edition, even though I'm now using MariaDB by default. Clearly, things are a little more complex than I anticipated. Sorry about that.Take a look at the API for the MariaDB connector module and compare it to the MySQL one. If they are compatible, a small edit to the imports statements at the top of the
DBcmmodule may be all that's required here.Let me know how you get on.
--Paul.