mysql && mysql container ignore case configuration

First, you can connect to mysql, and then enter the following command to check whether mysql ignores case

 show global variables like '%lower_case%';

 

lower_case_table_names = 0: do not ignore case

lower_case_table_names = 1: ignore case

There are two types of mysql installation (choose according to your own mysql installation method):

Program installation:

1. Find the my.cnf configuration file

find / -name my.cnf

2. Then add the following line of configuration in [mysqld]

lower_case_table_names=1

3. Then restart the mysql service

systemctl restart mysql

Container installation:

1. Enter the container and copy the configuration file to the host

docker exec -it container id bash

2. Find the location of the my.cnf configuration file

find / -name my.cnf

3. Copy the my.cnf configuration file of the container to the host

docker cp container id: location path of my.cnf host directory path

4. Then modify the my.cnf file of the host machine, and add the following line configuration in [mysqld]

lower_case_table_names=1

5. Restart the mysql container and mount the my.cnf configuration file

docker run --name mysql -v /root/mysql/data:/var/lib/mysql -v /home/mysql/my.cnf:/etc/my.cnf -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 -d mysql:tag

 

Guess you like

Origin blog.csdn.net/weixin_51689532/article/details/132317758