On server my application is looking for uppercase table name instead of lowercase On server my application is looking for uppercase table name instead of lowercase laravel laravel

On server my application is looking for uppercase table name instead of lowercase


Database and table names are not case sensitive in Windows, and case sensitive in most varieties of Unix or Linux. Table names in MySQL are file system entries, so they are case insensitive if the underlying file system is.

Although after applying the migration, it should work But in case if it is not working and you want both statements i.e. lower case and upper case name in table to succeed, you need to put the following line

lower_case_table_names = 1

in your /etc/my.cnf or wherever you keep your MySQL configuration.

Doctrine generated capital/CamelCase table names and MySQL stored them as lowercase!

Or

  1. Before export the database from local you can do these steps:

  2. open your MySQL configuration file: [drive]\xampp\mysql\bin\my.ini

  3. look up for: # The MySQL server [mysqld]

  4. add this right below it: lower_case_table_names = 2

  5. save the file and restart MySQL service

Be sure to add the system variable to [mysqld] section of the configuration file.

For more information you can check the MySQL Reference Link.


I had the following line in my code:

    $tags = DB::table('Tags')->get();

worked perfectly locally on my windows XAMPP, but needed to change it to:

    $tags = DB::table('tags')->get();

to work on my server.


the case sensitivity depends on your underlying filesystem, which explains the discrepancy between your local and production machine.

since this is a common problem, I'd recommend to use lowercase allover as a convention. change your Tags to tags in your migrations and also in your model and you should be good to go.

if you need to rename your table, rename it first to something_else, and than again to tags.