A mysql case-sensitive solution today, a colleague told me that the account and password were not case-sensitive when we logged on to the game. later, we found that creating accounts and roles were not case-sensitive. After thinking about the login process, Mysql is case insensitive.
I checked the information online. Mysql supports case-sensitive solutions. Several solutions have been found.
First, modify the database settings to make Mysql support case sensitivity. this solution is too radical and there is too much data in the database. in this way, the change may not cause any problems.
Second, modifying the table structure and character set is similar to the first solution, but the risk is lower.
Third, modify the stored procedure or SQL statement. The advantage is that the database structure is not moved. The disadvantage is that all changes are involved.
After the trade-off, we chose the third solution, which only modifies the two stored procedures for login and creation.
The method is to use the binary keyword of mysql.
BINARY is not a function, but a type conversion operator. it is used to force a string after it to be a BINARY string. it can be understood as case sensitive during string comparison.
The test is as follows:
Mysql> select binary 'ABC' = 'abc' ret1, 'ABC' = 'abc' ret2; + -------- + | ret1 | ret2 | + -------- + | 0 | 1 | + -------- + 1 row in set (0.00 sec)
The above is a case-sensitive mysql solution _ MySQL content. For more information, see PHP Chinese network (www.php1.cn )!