Why does the mysql password with the special character\ v report an error?

mysql> ALTER USER `db_example`@`%` IDENTIFIED BY "qeW0zdszb\vZjt4o";
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

mysql> ALTER USER `db_example`@`%` IDENTIFIED BY "qeW0zdszb\tZjt4o";
Query OK, 0 rows affected (0.00 sec)

MySQL version: 5.7
two passwords qeW0zdszb\ vZjt4o and qeW0zdszb\ tZjt4o are distinguished only by \ v or \ t

Why do passwords containing \ v report errors? What are the restrictions on setting a password in MySQL?

when using Spring to connect to the database, if the password has \ characters, the configuration also has to escape.

May.12,2022

MySQL itself supports some escape characters

Escape Sequence    Character Represented by Sequence
\0    An ASCII NUL (X'00') character
\'    A single quote (') character
\"    A double quote (") character
\b    A backspace character
\n    A newline (linefeed) character
\r    A carriage return character
\t    A tab character
\Z    ASCII 26 (Control+Z); see note following the table
\\    A backslash (\) character
\%    A % character; see note following the table
\_    A _ character; see note following the table

of course, it is turned on well by default, and you can do special handling in programs that do not need to be escaped.
but if you want to turn it off, you can SET sql_mode='NO_BACKSLASH_ESCAPES'; turn off the escape character


\ t is a tab. It seems to me that \ v is not a special character.
I guess: it should be that mysql deciphered the password string when setting the password, so that \ v did not have a corresponding interpretation and reported an error?
for example, if you change it to \\ v to see if you will report an error. And if you do not report an error, do you want to enter two \ or one? if it is one, it means that the password was indeed interpreted when you set it.

Menu