• Disclaimer

Developer Concepts

Camel case table names in MySQL

March 26, 2011 11:01 am / Steve

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)MySQLMySQL Server 5.5C:Program Files (x86)MySQLMySQL 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)MySQLMySQL Server 5.5C:Program Files (x86)MySQLMySQL 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.

CodeProject

Posted in: MySql, Visual Studio 2010 / Tagged: EF 4, Entity Framework 4, MySQL

Comments are closed.

Post Navigation

← Previous Post
Next Post →

Recent Posts

  • Unrecognized element folderLevelBuildProviders
  • Using Javascript to Load Blog Posts From WordPress
  • An introduction to KnockoutJS Observables
  • Automating NTLM logins with Selenium
  • KnockoutJS and Web API

Recent Comments

    Archives

    • July 2015
    • April 2015
    • March 2015
    • November 2014
    • October 2014
    • June 2014
    • May 2014
    • March 2014
    • February 2014
    • November 2013
    • August 2013
    • January 2013
    • November 2012
    • May 2012
    • September 2011
    • July 2011
    • May 2011
    • March 2011
    • November 2010
    • September 2010
    • February 2010
    • December 2009
    • November 2009
    • October 2009

    Categories

    • Architecture
    • Caching
    • Code Smells
    • Html 5
    • IOC
    • Javascript
    • Jquery
    • JSON
    • KnockoutJS
    • Linq
    • Linq To Xml
    • Mocking
    • MVC
    • MVVM
    • MySql
    • NHibernate
    • Selenium
    • Silverlight
    • Solving Errors
    • Sql
    • TDD
    • Uncategorized
    • Unit Testing
    • Visual Studio 2010
    • WCF

    Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
    © Copyright 2019 - Developer Concepts
    Infinity Theme by DesignCoral / WordPress