mariadb/mysql-test/main/charset_client_win_utf8mb4.test
Vladislav Vaintroub 71966c7306 MDEV-26713 allow users with non-UTF8 passwords to login after upgrade.
Translate username, password and database from UTF8 into desired charset,
if  non-auto default-character-set was used, on Windows10 1903

This change is implemented only in the command line client, and mainly to
allow users with non-UTF8 passwords to login.

The user is supposed to use the same charset that was used during setting
password (usually, console CP if used in CLI)

Add a test to document the behavior.
2021-12-15 19:13:57 +01:00

22 lines
834 B
Text

--source include/windows.inc
--source include/check_utf8_cli.inc
--exec $MYSQL --default-character-set=auto -e "select @@character_set_client"
# Test that a user with old, non-UTF8 password can still connect
# by setting setting non-auto --default-character-set
# This is important for backward compatibility
# Emulate creating password in an interactive client session, with older clients
# which communicates with the server using with something like cp850
exec chcp 850 > NUL && echo CREATE USER 'u' IDENTIFIED by 'ü' | $MYSQL --default-character-set=cp850;
# Can't connect with UTF8
--error 1
exec $MYSQL --default-character-set=auto --user=u --password=ü -e "select 1" 2>&1;
# Can connect with tweaked --default-character-set
exec $MYSQL --default-character-set=cp850 --user=u --password=ü -e "select 2";
DROP user u;