MySQL case-insensitive configuration under Linux

MySQL in windows ignores case by default, but it is different in Linux, so when our sql script in Windows is imported into Linux environment, there will be problems. The way we solve it is to also use MySQL in Linux. set to case insensitive

1. Open etc/mysql/my.cnf in Linux Some version paths are etc/my.cnf

The specific commands are as follows: sudo vim etc/mysql/my.cnf

Then add the following:

[mysqld]
lower_case_table_names =1


As shown below:

Then use the :wq command to save

Restart the mysql service with service mysql restart, or restart MySQL with /etc/init.d/mysql restart.

Login mysql command mysql -uroot -p

Enter the mysql password, then enter mysql, use the following command to view

mysql>show variables like "%case%";

       +------------------------+-------+
  | Variable_name          | Value |
  +------------------------+-------+
  | lower_case_file_system | OFF   | 
  | lower_case_table_names | 1     |     //0区分 1不区分
  +------------------------+-------+

1 means no distinction, the modification is successful!

Guess you like

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