I have a problem with changing lower_case_table_names variable value in MySQL 5.6 ...
I did all that says in Where to change the value of lower_case_table_names=2 on windows xampp.
The default value on my Windows 7 is '1'. I want to switch it to '2'.
Tried several ways, what I did is:
Edited C:\Program Files\MySQL\MySQL Server 5.6\my-default.ini by adding lower_case_table_names = 2 to wherever I could (without # symbol ofc)
Copied my-default.ini and pasted to the same directory, but renamed to my.ini
Copied my.ini to \bin folder
Restarted MySQL56 service couple times
Now, when I read "SELECT ##lower_case_table_names" it still says 1, and my db behaves like it is 1...
Any ideas?
I solved this with a file I found under
C:\ProgramData\MySQL\MySQL Server 5.6\my.ini
So, it was ProgramData, not Program Files. I got this path from MySQL Workbench -> Manage Server Instances -> [tab] System Profile -> Configuration File. Guess this is the place where one should look for the current config filepath.
Related
I installed version 8 of MySQL and I can't find the configuration file
I was reading and everyone says that it is inside the "MySQL Server x.0" folder, but in my case it does not appear, neither inside the "etc" or "bin" folder
How I found mine was like this;
mysqld --help --verbose | grep my.cnf
I guess you are on Windows because of the "MySQL Server x.0" folder name (on Mac & Linux, this folder name does not contain spaces by default).
No configuration file is created after a standard installation. You may create one if you have the need to specify any options. Otherwise every option has a default setting built into the MySQL Server.
On Windows, the MySQL Server searches several locations for the configuration file, so you can put the file in any of those locations.
See documentation for a list of the locations the server searches for the configuration file on Windows:
https://dev.mysql.com/doc/refman/8.0/en/windows-create-option-file.html
https://dev.mysql.com/doc/refman/8.0/en/option-files.html
Remember that after you edit the configuration file, you need to restart the MySQL Server. It reads the configuration options only when the server starts.
On Windows my.ini file will be auto generated when you install MySQL server. It will be located in a hidden directory ProgramData.
C:\ProgramData\MySQL\MySQL Server 8.0
In order to view these files you may need to show hidden items. To do that
Open file explorer > View > Tick Hidden Items
I am trying to change the lower_case_file_system to 'ON' in MySQL, but do not know how to do it. I'd like to set it up as case-non-sensitive.
According to the MySQL 8.0 Reference Manual, 'This variable describes the case sensitivity of file names on the file system where the data directory is located. OFF means file names are case-sensitive, ON means they are not case-sensitive. This variable is read-only because it reflects a file system attribute and setting it would have no effect on the file system.'
How can I change the value? Any idea, please? Thanks!
Carolina
enter image description here
Assuming it's through XAMPP.
Do these steps:
open your MySQL configuration file: [drive]\xampp\mysql\bin\my.ini
look up for: # The MySQL server [mysqld]
add this right below it: lower_case_table_names = 2
save the file and restart MySQL service
From: http://webdev.issimplified.com/2010/03/02/mysql-on-windows-force-table-names-to-lowercase/
In order to use camelCaseNames in table names and views, lower_case_table_names has to be 0
Might want to check here too:
As per this link, lower_case_table_names should be set together with --initialize option.
If on Ubuntu:
https://bugs.mysql.com/bug.php?id=90695 this is not supported out of the box. So the workaround is this
lower_case_table_names=1 on Ubuntu 18.04 doesn't let mysql to start
Finally, read the official sources:
https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html
https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html
https://forums.mysql.com/read.php?10,377683
On Mysql Server 8.0 Windows os, if you change lower_case_table_names=2 in mysql.ini the server will not start so you have to follow this
step 1: Backup all data / export to .sql or Dump all data
step 2: Stop the server from service
step 3: Delete the data folder from C:\Program Files\ Mysql Server 8.0\Data
step 4: Open C:\Program Files\ Mysql Server 8.0\my.ini as an administrator using notepad
step: 5 find set lower_case_table_names= 2 if you want camelCase table name
step: 6 open mysql installer and open reconfigure then open ->show advanced and logging option -> Advanced Options -> use second option from the list
step: 7 then everything will be ok
In my machine (Windows 10) two MySQl versions are needed. The Project "A" is running in XAMPP. When I've started my second project, I've stopped the first SQL services and installed MySQL 5.7. In that I need to set lower_case_table_names = 2 for the case sensitive method.
I google it, they say:
open your MySQL configuration file: [drive]\xampp\mysql\bin\my.ini
look up for: # The MySQL server [mysqld]
add this right below it: lower_case_table_names = 2
save the file and restart MySQL service
I know that it's for XAMPP only.
But I've installed MySQL in Program Files. Here I couldn't able to see C:\Program Files\MySQL\MySQL Server 5.7\bin\my.ini files. Then where should I set the lower_case_table_names = 2 value?
Thanks in advance.
In XAMPP use the "Control Panel" to find the mysql.ini config file.
In a regular Windows install of MySQL the .ini file sits in C:\ProgramData\MySQL\MySQL Server.
I have already seen
http://dev.mysql.com/doc/refman/4.1/en/mysql-config-wizard-file-location.html
how to know mysql my.cnf location
and
http://dev.mysql.com/doc/refman/5.1/en/option-files.html
But I am still stuck with the ages old question!
"Where is my my.ini"
I am using windows server 2008 with mysql 5.5.28. I installed the service using mysqld --install and I am able to use the mysql server using sqlyog. But unfortunately I am not able to find my.ini in installation directory or not in c:\ neither in c:\windows nor in data_dir query show variables like "mysql_home" returned nothing as well.
Any suggestions?
my.ini LOCATION ON WINDOWS MYSQL 5.6 MSI (USING THE INSTALL WIZARD)
Open a Windows command shell and type: echo %PROGRAMDATA%. On Windows Vista this results in: C:\ProgramData.
According to http://dev.mysql.com/doc/refman/5.6/en/option-files.html, the first location MySQL will look under is in %PROGRAMDATA%\MySQL\MySQL Server 5.6\my.ini. In your Windows shell if you do ls "%PROGRAMDATA%\MySQL\MySQL Server 5.6\my.ini", you will see that the file is there.
Unlike most suggestions you will find in Stackoverflow and around the web, putting the file in C:\Program Files\MySQL\MySQL Server 5.6\my.ini WILL NOT WORK. Neither will C:\Program Files (x86)\MySQL\MySQL Server 5.1. The reason being quoted on the MySQL link posted above:
On Windows, MySQL programs read startup options from the following
files, in the specified order (top items are used first).
The 5.6 MSI installer does create a my.ini in the highest priority location, meaning no other file will ever be found/used, except for the one created by the installer.
The solution accepted above will not work for 5.6 MSI-based installs.
Enter "services.msc" on the Start menu search box.
Find MySQL service under Name column, for example, MySQL56.
Right click on MySQL service, and select Properties menu.
Look for "Path To Executable" under General tab, and there is your .ini file, for instance, "C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MYSQL56
I've found mine in
\ProgramData\MySQL\MySQL Server 8.0\
(It is a hidden folder)
You can type win+R and write %PROGRAMDATA% to access that folder, or just enable show hidden folder.
You have to look I the folder C:\Program Files\MySQL\MySQL Server 5.5 but there is a problem. When you perform an MSI install of MySQL, my.ini is not created. There will be sample .ini files in that folder. In order to use one of them, say my-medium.ini, you need to do the following before a MySQL restart:
cd C:\Program Files\MySQL\MySQL Server 5.5
copy my-medium.ini my.ini
net stop mysql
net start mysql
Once, you do this, my.ini can be read by C:\Program Files\MySQL\MySQL Server 5.5\bin\mysql.exe.
Start MySQL Workbench, then Server -> Options File and look at bottom of the window; it will say something like "Configuration File: C:\ProgramData\MySQL\MySQL Server 5.6\my.ini"
(And note the subtle difference between "ProgramData" and "Program Files" - easy to gloss over if you're looking for a quick answer.)
Answered for only MySQL Workbench users,
You can find the my.ini file in windows at this location-
C:\ProgramData\MySQL\MySQL Server 5.6
the ProgramData folder is a hidden folder, so make the according setting to see that folder.
And open my.ini file as an administrator to edit and then save that.
In my case, the folder ProgramData was hidden by default on windows 7, so I was unable to find my.ini file.
After selecting show hidden files and folders option, I was able to find the my.ini file at the location: C:\ProgramData\MySQL\MySQL Server 5.6.
Display hidden files and folders on windows 7:
Right-click the Windows Logo button and choose Open Windows Explorer.
Click Organize and choose Folder and Search Options.
Click the View tab, select Show hidden files and folders and then clear the checkbox for Hide protected system operating files.
Click Yes on the warning and then click OK.
Press the windows key > type services > press enter > Look up mysql in the list > right click > properties > Path to Executable will have the location of the defaults file right below it (my.ini)
it is there at C:\Program Files\MySQL\MySQL Server 5.5 there are various .ini files with small, medium & large names. generally medium is used or it depends on your requirement.
programData is hidden folder so you have to change the option from setting to show hidden folder and then make the change in my.ini file present in that.
Be sure to update the correct my.ini file because it can waste a lot of your time if you keep updating wrong file.
You can look into service to see which my.ini is configured in this service.
Open your run console
type: services.msc
look for: mysql
right click
properties
where is written "path to executable", click and move the cursor to the right until you see the directory of my.ini, it's written "defaults-file-".
to reach it manually on your explore folders you have to enable the visualization of hidden elements (explore folder>top menu>visualize>visualize hidden elements)
as explained by this video
https://www.youtube.com/watch?v=SvCAa2XuQhg
on Windows if MySQL is install as a service you can change the binpath of the service. For example
sc config MySQL57 binPath= "\"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe\" --defaults-file=\"<myini path>" MySQL57"
space after binpath is important. You must escape double quotes
MySQL and MariaDB
According to the documentation of both MySQL and MariaDB you need to run mysql with --help --verbose to know the location of the my.ini file
Go to the command or terminal
cd yourMySQLBinDirectory
mysqld --verbose --help
You will see large output but first few lines will show the order the server is looking for the file. I got the following response. It will be different for your computer or server.
Default options are read from the following files in the given order:
C:\WINDOWS\my.ini C:\WINDOWS\my.cnf C:\my.ini C:\my.cnf D:\Databases\mariadb-10.3.30-winx64\my.ini D:\Databases\mariadb-10.3.30-winx64\my.cnf D:\Databases\mariadb-10.3.30-winx64\data\my.ini D:\Databases\mariadb-10.3.30-winx64\data\my.cnf
I met with the same problem when I did MSI install of MySQL and there were no my-medium.ini files too when I tried the above steps. Only installing the ZIP file of MySQL helped me. So, I suggest you to uninstall the MSI installed folder and reinstall using the ZIP file.
For MySql Server 8.0 The default location is %WINDIR% or C:\Windows.
You need to add a "my.ini" file there.
Here's a sample of what I put in the ini file.
[mysqld]
secure_file_priv=""
Make sure to restart the MySQL service after that.
I am using Windows 7 and XAMPP. I am trying to export my database and while in the process the table names are converted to lower case.
I have searched a lot, I know I have to change the value of lower_case_table_names from 0 to 2, but where do I have to change this value, in which file?
Do these steps:
open your MySQL configuration file: [drive]\xampp\mysql\bin\my.ini
look up for: # The MySQL server [mysqld]
add this right below it: lower_case_table_names = 2
save the file and restart MySQL service
From: http://webdev.issimplified.com/2010/03/02/mysql-on-windows-force-table-names-to-lowercase/
On linux I cannot set lower_case_table_names to 2 (it reverts to 0), but I can set it to 1.
Before changing this setting, do a complete dump of all databases, and drop all databases. You won't be able to drop them after setting lower_case_table_names to 1, because any uppercase characters in database or table names will prevent them from being referenced.
Then set lower_case_table_names to 1, restart MySQL, and re-load your data, which will convert everything to lowercase, including any subsequent queries made.
Try adding/editing lower_case_table_names = 2 in my.ini or my.cnf
I have same problem while importing database from linux to Windows.
It lowercases Database name aswell as Tables' name.
Use following steps for same problem:
Open c:\xampp\mysql\bin\my.ini in editor.
look for
# The MySQL server
[mysqld]
3 . Find
lower_case_table_names
and change value to 2
if not avail copy this at the end of this [mysqld] portion.
lower_case_table_names = 2
This will surely work.
Also works in Wampserver.
Click on the Green Wampserver Icon, choose MySql, then my.ini.
This will allow you to open the my.ini file.
Then -
look up for: # The MySQL server [mysqld]
add this right below it: lower_case_table_names = 2
save the file and restart MySQL service
Important Note - add the lower_case_table_names = 2 statement NOT under the [mysql] statement, but under the [mysqld] statement
Reference - http://doc.silverstripe.org/framework/en/installation/windows-wamp
If you have the file my-default.ini rename it to my.ini
ADD following -
look up for: # The MySQL server [mysqld]
add this right below it: lower_case_table_names = 1
In file - /etc/mysql/mysql.conf.d/mysqld.cnf
It's works for me.
Look for a file named my.ini in your hard disk, in my system it's in
c:\program files\mysql\mysql server 5.1
If it's not my.ini it should be my.cnf
On Mysql Server 8.0 Windows os, if you change lower_case_table_names=2 in mysql.ini the server will not start so you have to follow this
1: Backup all data / export to .sql or Dump all data
2: Stop the server from service
3: Delete the data folder from C:\Program Files\ Mysql Server 8.0\Data
4: Open C:\Program Files\ Mysql Server 8.0\my.ini as an administrator using notepad
5: find set lower_case_table_names= 2 if you want camelCase table name
6: open mysql installer and open reconfigure then open ->show advanced and logging option -> Advanced Options -> use second option from the list
7: then everything will be ok