MySQL 關於表名大小寫的引數
檢視現有的大小寫引數
[mysql@localhost percona]$ bin/mysql --defaults-file=/u01/mysql_data/my.cnf -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.17-11-log Percona Server (GPL), Release 11, Revision f60191c
mysql> show variables like '%lower%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 1 |
+------------------------+-------+
2 rows in set (0.00 sec)
lower_case_table_names的值為1,代表資料庫的表名不區分大小寫
mysql> use test
Database changed
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| b |
| c |
| cpu_stat |
| p |
| support_his |
| t |
| v_t |
| z |
+----------------+
8 rows in set (0.00 sec)
mysql> select * from t;
+---+
| a |
+---+
| 1 |
| 2 |
| 3 |
+---+
3 rows in set (0.04 sec)
mysql> select * from T;
+---+
| a |
+---+
| 1 |
| 2 |
| 3 |
+---+
3 rows in set (0.00 sec)
這個引數是靜態引數,不能線上修改,需要修改配置檔案
mysql> set global lower_case_table_names=0;
ERROR 1238 (HY000): Variable 'lower_case_table_names' is a read only variable
關閉資料庫
[mysql@localhost percona]$ bin/mysqladmin -uroot -S /u01/mysql_data/mysql.sock shutdown -p
修改引數
[mysql@localhost percona]$ vim /u01/mysql_data/my.cnf
[mysqld]
lower_case_table_names = 0
重啟資料庫
[mysql@localhost percona]$ bin/mysqld_safe --defaults-file=/u01/mysql_data/my.cnf &
[mysql@localhost percona]$ bin/mysql --defaults-file=/u01/mysql_data/my.cnf -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.17-11-log Percona Server (GPL), Release 11, Revision f60191c
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use test
Database changed
mysql> show variables like '%lower%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 0 |
+------------------------+-------+
2 rows in set (0.01 sec)
mysql> select * from T;
ERROR 1146 (42S02): Table 'test.T' doesn't exist
mysql> select * from t;
+---+
| a |
+---+
| 1 |
| 2 |
| 3 |
+---+
3 rows in set (0.02 sec)
注意:不建議在生產庫上面修改這個引數,可能導致現有的庫不能使用
引數lower_case_file_system決定作業系統中檔名的大小寫,是隻讀的,不能修改
[mysql@localhost percona]$ cd /u01/mysql_data/test/
[mysql@localhost test]$ ls
b.frm b.ibd c.frm c.ibd cpu_stat.frm cpu_stat.ibd db.opt p.frm p.ibd support_his.frm support_his.ibd t.frm t.ibd v_t.frm z.frm z.ibd
[mysql@localhost percona]$ bin/mysql --defaults-file=/u01/mysql_data/my.cnf -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.17-11-log Percona Server (GPL), Release 11, Revision f60191c
mysql> show variables like '%lower%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 1 |
+------------------------+-------+
2 rows in set (0.00 sec)
lower_case_table_names的值為1,代表資料庫的表名不區分大小寫
mysql> use test
Database changed
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| b |
| c |
| cpu_stat |
| p |
| support_his |
| t |
| v_t |
| z |
+----------------+
8 rows in set (0.00 sec)
mysql> select * from t;
+---+
| a |
+---+
| 1 |
| 2 |
| 3 |
+---+
3 rows in set (0.04 sec)
mysql> select * from T;
+---+
| a |
+---+
| 1 |
| 2 |
| 3 |
+---+
3 rows in set (0.00 sec)
這個引數是靜態引數,不能線上修改,需要修改配置檔案
mysql> set global lower_case_table_names=0;
ERROR 1238 (HY000): Variable 'lower_case_table_names' is a read only variable
關閉資料庫
[mysql@localhost percona]$ bin/mysqladmin -uroot -S /u01/mysql_data/mysql.sock shutdown -p
修改引數
[mysql@localhost percona]$ vim /u01/mysql_data/my.cnf
[mysqld]
lower_case_table_names = 0
重啟資料庫
[mysql@localhost percona]$ bin/mysqld_safe --defaults-file=/u01/mysql_data/my.cnf &
[mysql@localhost percona]$ bin/mysql --defaults-file=/u01/mysql_data/my.cnf -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.17-11-log Percona Server (GPL), Release 11, Revision f60191c
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use test
Database changed
mysql> show variables like '%lower%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 0 |
+------------------------+-------+
2 rows in set (0.01 sec)
mysql> select * from T;
ERROR 1146 (42S02): Table 'test.T' doesn't exist
mysql> select * from t;
+---+
| a |
+---+
| 1 |
| 2 |
| 3 |
+---+
3 rows in set (0.02 sec)
注意:不建議在生產庫上面修改這個引數,可能導致現有的庫不能使用
引數lower_case_file_system決定作業系統中檔名的大小寫,是隻讀的,不能修改
[mysql@localhost percona]$ cd /u01/mysql_data/test/
[mysql@localhost test]$ ls
b.frm b.ibd c.frm c.ibd cpu_stat.frm cpu_stat.ibd db.opt p.frm p.ibd support_his.frm support_his.ibd t.frm t.ibd v_t.frm z.frm z.ibd
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-2135770/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Mysql 表名大小寫問題MySql
- MySQL表名區分大小寫MySql
- 修改RAC引數指定節點名跟大小寫有關係
- MySQL表名不區分大小寫的設定方法MySql
- mysql表名忽略大小寫問題記錄MySql
- mysql8.0表名忽略大小寫(Ubuntu24.04)MySqlUbuntu
- MySQL 8 忽略表名大小寫MySql
- MySQL資料庫中庫、表名、欄位的大小寫問題MySql資料庫
- 關於MySQL 查詢表資料大小的總結MySql
- PowerDesigner表名、列名大小寫轉換
- 關於MySQL引數,這些你要知道MySql
- 設定MYSQL不區分表大小寫MySql
- 面試關於 MySQL 的編寫面試MySql
- 更改MySql表和欄位區分大小寫MySql
- MySQL效能相關引數MySql
- 檢視mysql表大小和記錄數MySql
- mysql大小寫敏感MySql
- MySQL中的大小寫敏感MySql
- ORACLE物件名大小寫敏感性相關的深入分析Oracle物件
- mysql 5.X 在linux上,表名大小寫敏感問題解決辦法MySqlLinux
- mysql中的表大小限制MySql
- 關於靜態引數和動態引數
- MySQL 連線相關引數MySql
- MySQL slow log相關引數MySql
- mysql~關於mysql分割槽表的測試MySql
- MySQL大小寫問題MySql
- jBoss下資料庫表名大小寫被自動更改的問題資料庫
- MySQL環境變數裡關於字符集character_set相關引數的解釋MySql變數
- mysql引數之innodb_buffer_pool_size大小設定MySql
- MySQL 庫大小、表大小、索引大小查詢命令MySql索引
- oracle 關於--引數檔案Oracle
- Swift 1.1語言函式引數的特殊情況本地引數名外部引數名Swift函式
- git提交時支援檔名大小寫的修改Git
- mysql用於分配記憶體的引數MySql記憶體
- mysql innodb相關引數說明MySql
- git預設忽略檔名大小寫Git
- mysql關於臨時表的總結MySql
- mysql關於表空間的總結MySql