Linux下設定MySQL不區分大小寫,mysql大小寫

來源:互聯網
上載者:User

Linux下設定MySQL不區分大小寫,mysql大小寫

        MySQL在Linux下資料庫名、表名、列名、別名大小寫規則: 
   1、資料庫名與表名是嚴格區分大小寫 
   2、表的別名是嚴格區分大小寫 
   3、列名與列的別名在所有的情況下均是忽略大小寫 
   4、變數名也是嚴格區分大小寫 
注意: 
A、Linux下MySQL安裝完後預設:區分表名的大小寫,不區分列名的大小寫 
B、改變表名的大小寫區分規則的方法:用root帳號登入,在/etc/my.cnf 或 /etc/mysql/my.cnf 中的[mysqld]下面添加添加lower_case_table_names=1

Java代碼  
  1. # The MySQL server  
  2. [mysqld]  
  3. port            = 3306  
  4. socket          = /var/lib/mysql/mysql.sock  
  5. skip-external-locking  
  6. key_buffer_size = 16M  
  7. max_allowed_packet = 1M  
  8. table_open_cache = 64  
  9. sort_buffer_size = 512K  
  10. net_buffer_length = 8K  
  11. read_buffer_size = 256K  
  12. read_rnd_buffer_size = 512K  
  13. myisam_sort_buffer_size = 8M  
  14. # add here  
  15. lower_case_table_names=1  

 
重啟MySQL服務,若設定成功,則不再區分表名大小寫。 


MySQL在Windows下資料庫名、表名、列名、別名都不區分大小寫。 
如果想大小寫區分則在my.ini 裡面的mysqld部分 
加入 lower_case_table_names=0 
注意:Windows中即使改了這個設定,在查詢時還是不會區分大小寫。只是在匯入匯出時會對大小寫有區別。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.