Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Lower_case_table_names parameter setting solves Error Code: 1146. Table doesn't exist?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

After using mysqldump to export DB in MariaDB 10.2.11 for windows and importing Mysql 5.7.16 for Linux, the program execution Times error: Error Code: 1146. Table XXX doesn't exist

Check the program code and find that it runs SQL: SELECT * FROM Base_User. An error was reported, but table was present in the check Mysql 5.7.16 for Linux.

Trying to change the hump table name (Base_User) in SQL to the all-lowercase table name SELECT * FROM base_user works normally because it is size-sensitive by default in Mysql for Linux and insensitive by default in windows.

Case insensitive after setting parameter lower_case_table_names to 1 for my.cnf and restarting mysql

[mysqld]

Lower_case_table_names=1

Reference documentation:

Lower_case_table_names

PropertyValueCommand-Line Format--lower-case-table-names [= #] System Variablelower_case_table_namesScopeGlobalDynamicNoTypeintegerDefault0Minimum0Maximum2

If set to 0, table names are stored as specified and comparisons are case-sensitive.

If set to 1, table names are stored in lowercase on disk and comparisons are not case sensitive.

If set to 2, table names are stored as given but compared in lowercase. This option also applies to database names and table aliases.

On Windows the default value is 1. On OS X, the default value is 2.

You should not set lower_case_table_names to 0 if you are running MySQL on a system where the data directory resides on a case-insensitive file system (such as on Windows or OS X).

It is an unsupported combination that could result ina hang condition when running an INSERT INTO... SELECT... FROM tbl_nameoperation with the wrong tbl_name letter case. With MyISAM, accessing table names using different letter cases could cause index corruption.

As of MySQL 5.7.9, an error message is printed and the server exits if you attempt to start the server with-- lower_case_table_names=0 on a case-insensitive file system.

If you are using InnoDB tables, you should set this variable to 1 on all platforms to force names to be converted to lowercase.

The setting of this variable in MySQL 5.7 affects the behavior of replication filtering options with regard to case sensitivity.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report