Set Lower Case Tables Names for MySQL on Ubuntu

Mark Harwood
2 min readJul 16, 2024

Today, I wanted to show you how to set lower case tables names for MySQL on Ubuntu. I recently had this issue as some software we used required this to be set.

I’ll explain why this was a pain in the introduction. For now, just know that you can read this on my website if you prefer!

Introduction

I mentioned above that this was a painful process. It’s painful because MySQL ships with this NOT set by default. And once MySQL is initialised, you can’t just flick a switch. You instead need to rebuild MySQL and start again!

So I wanted to take some time today and show you that process.

This took me about 3 hours to figure out and put together, so I hope someone appreciates it…

Set Lower Case Tables Names for MySQL on Ubuntu

First, we need to stop MySQL:

sudo service mysql stop

Then we need to remove the MySQL directory inside of lib and recreate it with the correct permissions and owner:

sudo rm -rf /var/lib/mysql
sudo mkdir /var/lib/mysql
sudo chown mysql:mysql /var/lib/mysql
sudo chmod 700 /var/lib/mysql

If you’re interested in what the above

--

--

Mark Harwood

IT Pro 👨‍💻 Dad 👀 Husband🔒 Check out my free blog or utilise my expertise on the web! https://mharwood.uk