Home  >  Article  >  Database  >  Mysql capitalization problems and solutions

Mysql capitalization problems and solutions

小云云
小云云Original
2017-11-23 09:56:401697browse

When we create a database, we may encounter various problems. For example, when we create a mysql table, we find that no matter whether it is uppercase or lowercase, it will be changed to lowercase after it is built. So what is going on? ?

Reason: MySQL is not case-sensitive under windows. After importing the script file into MySQL, the table name will be automatically converted to lowercase.

Solution: (based on Windows system method)

Find the my.ini file in the mysql installation directory, and add at the end of the file (1 means case-insensitive, 2 means size Write sensitive)

1 lower_case_table_names=2

Then restart mysql, cmd command line input:

1 net stop mysql2 net start mysql

Then in mysql In the command interface, enter:

show variables like '%low%';

. It is found that it is already case-sensitive, and the setting is successful.

In addition, when using Navcat to execute sql scripts, you may encounter a problem: it is obvious that the script statements execute table names in uppercase, but after the construction is completed, it is found that some table names have still been changed. It has become a lowercase format

For example: (A strange lowercase table name suddenly appears in all uppercase tables, the reason is unknown)

Solution,

1. Manually use Command changes.

1 rename table t_meeting to t_m; 2 rename table t_m to T_MEETING;

2. Find the data file and rename it directly:

File path: C:\ProgramData\MySQL \MySQL Server 5.5\data

Just find the corresponding database and rename the corresponding table. Because renaming with Navcat seems to have no effect. It may be a problem with my version, so it is not recommended to modify it directly with Navcat.

Have you ever encountered this kind of problem when you created the database? If yes, then try the above solutions.

Related recommendations:

Problems encountered when CI connects to multiple databases

Common MySQL problems and solutions

Questions about MySQL triggers

The above is the detailed content of Mysql capitalization problems and solutions. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn