About the case sensitivity of Mysql

Since the mysql database directly corresponds to the data directory, and the tables and triggers correspond to the files in the directory, whether the mysql identifier is case-sensitive or not is not only related to the operating system, but also to which object it is.

By default, mysql is case sensitive like this:

  • Field names, field aliases, index names, stored procedure names..., as long as directories and files are not involved, any platform is not case-sensitive;
  • For Windows platform, database name, table name, table alias, trigger name, etc., are not case-sensitive;
  • Unix, Linux platform, database name, table name, table alias, trigger name, etc., should be case-sensitive;
  • The name of the log file group is case-sensitive, which is generally not paid attention to by many people;
  • Variable names are strictly case-sensitive.

In order to prevent the same code from being abnormal on different platforms, there are usually two methods:

  • Statements involving databases, tables, and triggers are always in lowercase;
  • In the [mysqld] section of my.ini, add " lower_case_table_names=1 ".

By the way, about other databases:

  • Oracle: The default is case-insensitive, table names, field names, etc. are not case-sensitive, lowercase letters are automatically converted to uppercase letters, and double quotation marks need to be used when lowercase letters are required.
  • PostgreSQL: The default is case-insensitive, table names, field names, etc. are not case-sensitive, uppercase letters are automatically converted to lowercase letters (just the opposite of Oracle), and double quotation marks need to be used when uppercase letters are required.
  •  SQLServer: The default is case insensitive; can be changed by modifying the collation.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325009039&siteId=291194637