首页 > 代码库 > msyql5.5设置不区分大小写

msyql5.5设置不区分大小写

mysql的版本

mysql> select version()\G

*************************** 1. row ***************************

version(): 5.5.39

msyql默认是区分大小写的

创建数据库ZPF

mysql> create database ZPF;

Query OK, 1 row affected (0.00 sec)

修改my.cnf

[mysqld]下添加 lower_case_table_names=1

重启mysql

[root@z2 ~]# /application/mysql/bin/mysql.server restart

Shutting down MySQL... SUCCESS! 

Starting MySQL.. SUCCESS! 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| ZPF                |

| mysql              |

| performance_schema |

| test               |

| wordpress          |

+--------------------+

6 rows in set (0.00 sec)


mysql> use zpf;

ERROR 1049 (42000): Unknown database ‘zpf‘

mysql> use ZPF;

ERROR 1049 (42000): Unknown database ‘zpf‘

报错,因为ZPF库是在数据库区分大小写的时候创建的

关闭数据库

/application/mysql/bin/mysql.server stop

修改数据库名

mv /application/mysql/data/ZPF /application/mysql/data/zpf

启动数据库

/application/mysql/bin/mysql.server start

在登陆mysql测试

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

| wordpress          |

| zpf                |

+--------------------+

mysql> use zpf;

Database changed

mysql> use ZPf;

Database changed

msyql5.5设置不区分大小写