Click here to Skip to main content
15,887,135 members
Articles / Database Development / MySQL

Camel Case Table Names in MySQL

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
27 Mar 2011CPOL1 min read 24.6K   2   2
A solution to casing problems in MySQL

I have been working with Entity Framework 4 and MySQL. The main problem I have found is that since I am working on a Windows server, the table names in the database are all lower case. This means that when I create the entities in Visual Studio, the classes are all lower case.

So I have found this solution:

There is a setting in the configuration file in the MySQL server directory. I am using Windows 7, so this was under: C:\Program Files (x86)\MySQL\MySQL Server 5.5C:\Program Files (x86)\MySQL\MySQL In this Server 5.5\.

In this directory, you will find a file: my.cnf. This governs how MySQL runs. You will need to change or add a line to allow Camel casing of table names. Please note that you should read http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html. This details the changes and how they should be used on different Operating Systems. I am only detailing how I got this to work on Windows. If you are running Linux, then please go to the link mentioned above to make sure that the change will not affect your system / MySQL instance.

Steps taken to allow Camel casing:

  • Go to Control Panel –> Administrative Tools –> Services.
  • Stop the MySQL Service.
  • Open C:\Program Files (x86)\MySQL\MySQL Server 5.5C:\Program Files (x86)\MySQL\MySQL In this Server 5.5\.
  • Open the my.cnf file as Administrator.
  • Add the line lower_case_table_names=2 under the mysqld section. If this line is there, then just change the value to ‘2’. Make sure that there is only one line there.
  • Go back to Services and restart MySQL.

You should be done. Hope this short guide has helped.

This article was originally posted at http://www.makecodingeasy.com?p=171

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralThanks! Pin
Mertiin13-Jul-14 21:17
Mertiin13-Jul-14 21:17 
GeneralVery good post to learn MySQL Pin
Kelly Blue17-Jun-11 20:54
Kelly Blue17-Jun-11 20:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.