question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Connection settings should accept 'collate' as a property

See original GitHub issue

I’m using mysql2 with knex.

The default connection when using utf8mb4 seems to pick the first collate in the list (that being utf8mb4_0900_ai_ci).

When I pass in utf8mb4_general_ci as collate property in connection settings for knex it gets passed down through mysql2 where it logs the following message:

Ignoring invalid configuration option passed to Connection: collate. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection

But in order to have the knex_migrations table use the correct collate when it intially created it needs to have the collate option passed into it.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
simontongcommented, Nov 17, 2019

OK, appears to only happen when I’m using knex and mysql2 together. If I use mysql2 on its own the error does not appear. I stepped through the code and getCharsetNumber in connection_config.js thinking that was throwing an error.

It appears to be a knex issue, its trying to create the knex_migrations table with character set utf8mb4_general_ci when it should be character set utf8m4 collate utf8mb4_general_ci.

Thank you, feel free to close the issue as it does not relate to mysql2.

1reaction
simontongcommented, Nov 17, 2019

My understanding is that whatever you put into knex client connection settings will get passed down to mysql2 connection settings

I tested it using utf8mb4_general_ci and am getting an error:

Unknown character set: 'utf8mb4_general_ci'

I believe this is because utf8mb4 is a character set while utf8mb4_general_ci is a collation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL Server collation introduction with collate SQL casting
SQL Server collation indicates set of rules on how information can be stored, compared, and arranged in the T-SQL query statement.
Read more >
Set or change the database collation - SQL Server
To change the collation of an existing database, requires ALTER permission on the database. Set or change the database collation using SSMS. In ......
Read more >
Setting collation property in the connection string to SQL ...
This page lists all the properties you can set in the connection string for SQL Server. There's no such 'collation' property you can...
Read more >
SQL Server Collation Settings and Processes
SSMS: Open properties by right clicking on properties. Once there, access the 'Options' tab. SQL Server Collation. Column Level. Collations ...
Read more >
Deep Security Manager settings properties file
Used only with Microsoft SQL Server. Collation determines how strings are sorted and compared. If the value is "False", Deep Security will use ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found