Why my tables' names are converted into lowercase in phpmyadmin?
Asked Answered
M

8

37

I am using wamp server 2.0 on Windows XP. Whenever I create a table with some uppercases in name, it is converted to lowercase.

For example:

I create: UserInfo
phpmyadmin convert it to: userinfo

I am using ubuntu/phpmyadmin in office but this problem does exists there.

from where can I fix this. Thanks

Marcelinomarcell answered 17/4, 2010 at 19:23 Comment(0)
C
21

There is a directive for forcing table names to lower case.

You want to set the lower_case_table_names value to 0.

You can read more about it from MySQL documentation here

Cate answered 17/4, 2010 at 19:26 Comment(6)
in which file I will set lower_case_table_names to 0.Marcelinomarcell
I updated my answer to give a better link. It's a system variable that you set. The MySQL documentation can tell you how.Cate
c:/mysql/my.ini for example. but I'd go with lower_case_table_names = 2, not 0, because with 2 "table names are stored as given but compared in lowercase".Aquavit
In Wamp go to C:\wamp\bin\mysql\mysql5.6.17\my.ini find [mysqld] and add the line: lower_case_table_names = 2Sapp
Need to restart MySql service to apply the changes in my.ini fileCreak
did as directed, after adding that line, the services will not restart.Mantel
W
23

I've tried what's been suggested here, i must inform that

lower_case_table_names = 0

doesn't work in xampp, it crashes MySQL service at the moment you restart it. Yet

lower_case_table_names = 2

didn't crash, and apparently worked... at least it allowed me to insert a db with camel case.

Wearisome answered 22/3, 2016 at 17:46 Comment(3)
Using lower_case_table_names = 0 crashed it for me too (MySQL 5.7, Windows 10). I was unable to start the service again after changing it. Using lower_case_table_names = 2 workedBizarre
The case was the same for me WAMP64, Windows 10, lower_case_table_names = 0 crashed MySQL 5.7.19 lower_case_table_names = 2 worked.Surrebuttal
In MySql 8.0. only 1 value works. Service crashes immediately if I use 0 or 2. I'm used standard installer for mysqlBoothman
C
21

There is a directive for forcing table names to lower case.

You want to set the lower_case_table_names value to 0.

You can read more about it from MySQL documentation here

Cate answered 17/4, 2010 at 19:26 Comment(6)
in which file I will set lower_case_table_names to 0.Marcelinomarcell
I updated my answer to give a better link. It's a system variable that you set. The MySQL documentation can tell you how.Cate
c:/mysql/my.ini for example. but I'd go with lower_case_table_names = 2, not 0, because with 2 "table names are stored as given but compared in lowercase".Aquavit
In Wamp go to C:\wamp\bin\mysql\mysql5.6.17\my.ini find [mysqld] and add the line: lower_case_table_names = 2Sapp
Need to restart MySql service to apply the changes in my.ini fileCreak
did as directed, after adding that line, the services will not restart.Mantel
B
7

In windows the default value for lower_case_table_names = 1.

You need to change or add this value to my.ini file in your mysql folder..

If this line is not found, then add it under [mysqld]

lower_case_table_names = 0

And then restart the wamp services, it will work :D

Brittnee answered 28/1, 2016 at 8:54 Comment(1)
You should use lower_case_table_names = 2 when using Windows.Beichner
L
4

You must find file my.ini in your mysql folder and change, or add this line:

lower_case_table_names value = 0
Lassie answered 4/12, 2012 at 9:7 Comment(1)
Add it underneath [mysqld] on a new line.Surrebuttal
I
4
  • Step 1: open your MySQL configuration file: [drive]\xampp\mysql\bin\my.ini or open xampp click on mysql -> config then open my.ini file
  • Step 2: Search [mysqld] for: # The MySQL server [mysqld] in my.ini file
  • Step 3: Add this :lower_case_table_names=2
  • Step 4: save the file and restart MySQL service or (Xampp)
Intensity answered 15/8, 2020 at 8:42 Comment(0)
D
3

You need to find file my.ini in your mysql folder and change, or add this line at bottom:

lower_case_table_names = 2

Devol answered 20/11, 2018 at 14:29 Comment(0)
C
2

It was not phpMyAdmin. MySQL did this.

p.s. It is a bad practice to use camelCase in databases. Use _underlines instead. :)

Collyer answered 17/4, 2010 at 19:30 Comment(2)
because almost all databases does not make difference between lower and upper cases.Collyer
I had a WordPress plugin developer who used camelCasing in their plugin tables. Are you saying that it should not be a regular practice?Surrebuttal
S
0

Those of you working on windows and xampp:

1.23 I'm running MySQL on a Win32 machine. Each time I create a new table the table and column names are changed to lowercase!

This happens because the MySQL directive lower_case_table_names defaults to 1 (ON) in the Win32 version of MySQL. You can change this behavior by simply changing the directive to 0 (OFF): Just edit your my.ini file that should be located in your Windows directory and add the following line to the group [mysqld]:

.. code-block:: ini

set-variable = lower_case_table_names=0

.. note::

Forcing this variable to 0 with --lower-case-table-names=0 on a
case-insensitive filesystem and access MyISAM tablenames using different
lettercases, index corruption may result.

Next, save the file and restart the MySQL service. You can always check the value of this directive using the query

.. code-block:: mysql

SHOW VARIABLES LIKE 'lower_case_table_names';

.. seealso:: Identifier Case Sensitivity in the MySQL Reference Manual <https://dev.mysql.com/doc/refman/5.7/en/identifier-case-sensitivity.html>_

.. _faq1_24:

Skyeskyhigh answered 2/6 at 19:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.