💥

New-gen Dedicated Servers Available in UK and Netherlands

English

Home

Blog

How To Fix the lower_case_table_names Is...

How To Fix the lower_case_table_names Issue in MySQL 8 on Linux Server

How To Fix the lower_case_table_names Issue in MySQL 8 on Linux Server

NetShop ISP

NetShop ISP · Blog Author

Sep 26, 2025 · Technical Tutorials

When running MySQL 8 on Linux servers, you may encounter problems with case sensitivity in table names.

On Linux, file systems are case-sensitive, which means Table1 and table1 are treated as different objects. On Windows or macOS, however, MySQL defaults to case-insensitive behavior.

This difference can lead to issues such as:

  • Failing imports of database dumps created on Windows servers
  • Failing to synchronize data with Forex CRM systems that use lowercase table names as the MetaTrader 4 application uses uppercase format.
  • WordPress or other CMS breaking due to mismatched table casing
  • Replication errors when syncing from case-insensitive servers

The MySQL system variable lower_case_table_names controls this behavior.

In this guide, we explain how to correctly configure lower_case_table_names=1 in MySQL 8 running on any Linux distribution (Debian, Ubuntu, CentOS, Rocky, AlmaLinux, etc.).

Prerequisites

  • A server running Linux with MySQL 8.x installed
  • Root or sudo access
  • A full database backup (the process we describe in this tutorial wipes the MySQL system tables)

Step 1: Stop the MySQL Service

The command to stop MySQL differs slightly by distribution:

Debian/Ubuntu:

root@localhost:~$ systemctl stop mysql

CentOS/RHEL/RockyLinux/AlmaLinux:

root@localhost:~$ systemctl stop mysqld

Step 2: Check Existing Configurations

Make sure there are no conflicting entries for lower_case_table_names in the mysql configuration files:

root@localhost:~$ grep -RIn "lower_case_table_names" /etc/mysql /etc/my.cnf* || true

Edit your MySQL configuration file (my.cnf) and set:

[mysqld]
lower_case_table_names=1
  • Debian/Ubuntu: /etc/mysql/mysql.conf.d/mysqld.cnf
  • CentOS/RHEL-based: /etc/my.cnf or /etc/my.cnf.d/custom.cnf

Step 3: Confirm the Data Directory

Check which datadir MySQL is using:

root@localhost:~$ grep -RIn "^datadir" /etc/mysql /etc/my.cnf* || true

The default is usually /var/lib/mysql.

Step 4: Wipe and Recreate the Data Directory

Important: This destroys MySQL system tables. Ensure you have backups !!!

root@localhost:~$ rm -rf /var/lib/mysql/*
root@localhost:~$ mkdir -p /var/lib/mysql
root@localhost:~$ chown mysql:mysql /var/lib/mysql

Note: Replace /var/lib/mysql if your server uses a different datadir.

Step 5: Initialize MySQL with Lowercase Setting

Run the following command to reinitialize the system tables:

root@localhost:~$ sudo -u mysql /usr/sbin/mysqld \
  --no-defaults \
  --initialize-insecure \
  --lower_case_table_names=1 \
  --datadir=/var/lib/mysql \
  --log-error=/var/log/mysql/error.log


This ensures the lower_case_table_names=1 is embedded in the system dictionary.

Step 6: Restart MySQL

Start the service again:

Debian/Ubuntu/CentOS/RHEL/RockyLinux/AlmaLinux:

root@localhost:~$ systemctl start mysql

Step 7: Verify the Configuration

Check if MySQL is now case-insensitive:

root@localhost:~$ mysql -u root --skip-password -e "SHOW VARIABLES LIKE 'lower_case_table_names';"

Expected output:

+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_table_names | 1     |
+------------------------+-------+

Step 8: Reset the Root Password

Since MySQL was initialized insecurely, you must set a new root password:

root@localhost:~$ mysql -u root --skip-password -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'YourNewPassword'; ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;"

Conclusion

By forcing lower_case_table_names=1 during initialization, you ensure consistent, case-insensitive table handling for your MySQL databases.

Remember: you must set this variable before the data dictionary is created — changing it afterward is not supported.

At NetShop ISP, we help businesses configure, optimize, and troubleshoot databases, servers, and hosting infrastructure. Need expert assistance with MySQL migrations or performance tuning? Get in touch with our team.

Press Releases
90

Free VPS Trial

No Credit Card Required.

Recent Posts

How To Fix the lower_case_table_names Issue in MySQL 8 on Linux Server

How To Fix the lower_case_table_names Issue in MySQL 8 on Linux Server

26 September, 2025

NetShop ISP Completes Cross Connect with Microsoft Azure for Financial Services Client at LD4 Data Center

NetShop ISP Completes Cross Connect with Microsoft Azure for Financial Services Client at LD4 Data Center

16 September, 2025

How To Complete SSL Order in myNetShop Portal

How To Complete SSL Order in myNetShop Portal

05 September, 2025

Dedicated Servers in 2025: Why Businesses Are Moving Back

Dedicated Servers in 2025: Why Businesses Are Moving Back

02 September, 2025

Introducing Hybrid & Workload-based Cloud Backup Solutions

Introducing Hybrid & Workload-based Cloud Backup Solutions

19 August, 2025

#letushostyou

Award Winning Hosting Provider established in 2004.

120 Faneromenis Avenue, Imperial Tower, 2nd Floor, Larnaca 6031, Cyprus

Products

Bare Metal Servers

Customized Servers

Virtual / Cloud Servers

Forex VPS

Storage VPS

cPanel Web Hosting

Reseller Web Hosting

Colocation

Addons

Premium DNS

Email Hosting

Cloud Backup

DDoS Protection

Licenses

SSL Certificates

Domain Names

Premium SLAs

About Us

Data Center Locations

Looking Glass

Our Company

Contact Us

Careers in Cyprus

Become a Partner

Awards

Certifications

© 2025 S.S. NetShop Internet Services Ltd. All rights reserved.  Terms & Conditions  |  Privacy Policy
CY Reg. Number: HE 217340 | EU VAT Number: CY10217340J

Visa
Mastercard
PayPal
Bitcoin
Tether
Ethereum
Litecoin
Wise
Revolut
Wire Transfer