Skip to content

Conversation

dveeden
Copy link

@dveeden dveeden commented Apr 29, 2024

import mysql.connector c = mysql.connector.connect( host='127.0.0.1', port=3306, user="test", password="test", collation="utf8mb4_ja_0900_as_cs", ssl_disabled=True ) cur = c.cursor() cur.execute("SHOW SESSION VARIABLES LIKE '%collation%'"); for col in cur: print(col) cur.close() c.close()

Output:

('collation_connection', 'utf8mb4_ja_0900_as_cs') ('collation_database', 'utf8mb4_0900_ai_ci') ('collation_server', 'utf8mb4_ja_0900_as_cs') ('default_collation_for_utf8mb4', 'utf8mb4_0900_ai_ci') 

This uses the utf8mb4_ja_0900_as_cs collation, which has ID=303. And 303 in hex is 0x012f. If only the lower 8 bits are sent this would be 0x2f (47 decimal). However the 0x01 is actually sent in the next byte.

image

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment:
"I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it."
Thanks

@dveeden
Copy link
Author

dveeden commented Apr 29, 2024

I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

@dveeden dveeden force-pushed the docs_login_collation branch from 343e5d0 to ad9a93a Compare April 29, 2024 15:10
@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow
bug http://bugs.mysql.com/bug.php?id=114818 for updates.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants