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.
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 had mySQL workbench working fine a few weeks ago. Now, any time I log in, I get no connection. Upon inspecting Sever Status, it is showing Stopped. Also, under the Server Directories, it says Unable to Retrieve next to Disk Space in Data Dir.
I also noticed that the configuration file was wrong, or outdated? The Configuration File originally read:
C:\ProgramData\MySQL\MySQL Server 5.5\my.ini
But I looked and there was no MySQL Server 5.5 file in my directory. I do have a MySQL Server 8.0 folder, so I changed the Configuration File to:
C:\ProgramData\MySQL\MySQL Server 8.0\my.ini
However, this fails to solve the problem. I've also attempted to run Services from the Start Menu, right click on MYSQL80, and choose start - and it says the service has Started then stopped.
I'm not even sure this missing or mis-directed file is the issue, or whether it's the Unable to Retrieve Disk error (or both are causing the server to fail). I recently changed my login password for my computer - but I doubt that is related to the login credentials for MySQL, right? (I see MYSQL80 properties has password for 'log on' option, but I have no idea what this password even is, or how to change it).
I've also read about this problem online and cannot seem to find an answer that solves the issue. I've tried running MySQL Workbench as an admin too, and that doesn't work either.
Can anyone point me in the right direction? Is there a way to get the server up and running again without a bunch of complicated command line? I appear to have mysqld.exe in the bin file in MySQL 8.0
Thanks all in advance!
In MySql Workbench Server -> Startup/ShutDown -> Start Server.
This Worked for me.
When the my.ini file is messed up I think the best solution is a total uninstall/delete and manual install. Before you do any of the following make sure you go to your current data dir and save your database folders. Then dlete all of your current MySQL related directories and uninstall MySQL and MySQL workbench.
I had this problem when I installed MySQL 8.0.15 with the community installer. The my.ini file that came with the installer did not work correctly after it had been edited. I did a full manual install by downloading that zip folder. I was able to create my own my.ini file containing only the parameters that I was concerned about and it worked.
download zip file from MySQL website
unpack the folder into C:\program files\MySQL\MySQL8.0
within the MySQL8.0 folder that you unpacked the zip folder into, create a text file and save it as my.ini
include the parameters in that my.ini file that you are concerned about. so something like this(just ensure that there is already a folder created for the datadir or else initialization won't work):
[mysqld]
basedire=C:\program files\MySQL\MySQL8.0
datadir=D:\MySQL\Data
....continue with whatever parameters you want to include
initialize the data directory by running these two commands in the command prompt:
cd C:\program files\MySQL\MySQL8.0\bin
mysqld --default-file=C:\program files\MySQL\MySQL8.0\my.ini --initialize
install the MySQL server as a service by running these two commands:
cd C:\program files\MySQL\MySQL8.0\bin
mysqld --install --default-file=C:\program files\MySQL\MySQL8.0\my.ini
finally, start the server for the first time by running these two commands:
cd C:\program files\MySQL\MySQL8.0\bin
mysqld --console
So I'm configuring my database.
I've found these two guides which have a lot of the commands of what I need to use.
http://www.tecmint.com/mysql-backup-and-restore-commands-for-database-administration/
basically any of these commands
http://dev.mysql.com/doc/refman/5.6/en/programs-client.html
My issue is I don't know where to enter these commands.
I've tried in mysql workbench but it only accept normal sql code.
If your MySQL bin is not in your path variable then you first need to navigate to the folder where these commands reside.
For MySQL 5.5 the path was: C:\Program Files\MySQL\MySQL Server 5.5\bin
In a command-prompt, you can use the "cd" command to change you directory. e.g.:
cd "C:\Program Files\MySQL\MySQL Server 5.5\bin"
Also, if you are on Windows 7 and more comfortable using Windows Explorer. Click the start orb and then click Computer. Open Local Disk (C:) and then look in Program Files\MySQL. Open the folder for the version of MySQL you have. You can then hold down the Shift key and right-click on the bin folder. From the context menu choose "Open command window here".
In the WorkBench when I click on the Options File it says it can't find "C:\Program Files\MySQL\MySQL Server 5.0\my.ini"
I don't even have version 5.0 on the machine, I've only installed versions 5.6 and 5.7 of the server.
However there is a my.ini in "C:\ProgramData\MySQL\MySQL Server 5.5\my.ini".
If I just copy over the file I'm assuming that having two my.ini files will be confusing for the server. Or will they? And why is the WorkBench looking in the wrong place for this file?
Could this be why all login's except root have suddenly started to fail?
Have a look at the Connection settings. Right click on the connection adn select Edit Connections so you end up in Manage connections.
There is a tab called System Profile. Make sure that the path for Configuration file here is to the correct ini file. In your case the path should most likley be C:\ProgramData\MySQL\MySQL Server 5.5\my.ini
I am looking for the data directory of mysql server (5.1.42) I installed on my machine which runs win7.
There is no 'data' direcotory in C:\Program Files\MySQL\MySQL Server 5.1 and also in C:\Users\MyAccount\AppData\Local||LocalLow||Roaming
Different MySQL/Windows versions have different data folder locations. To get your ACTUAL data folder location just execute this SQL:
SHOW VARIABLES WHERE Variable_name LIKE '%dir'
Must be C:\ProgramData\MySQL\MySQL Server 5.1\data.
Was not really a good idea to place data here by default. It is compatible with various Vista compatibility requirements, but is eather hard to find, especially given the ProgramData folder is hidden.
You can find the data directory at this location
C:\ProgramData\MySQL\MySQL Server 5.5\data\<YourDataDirectory\TableName.frm>
The path can be defined in my.ini (located in Windows directory) as datadir.
I have had the problem to find the data directory too and even to start the mysql the second time after installing the server 5.7 on Windows 7.
In contrary to some answers here and to the documentation (the part about location of my.ini), the my.ini location was c:\ProgramData\MySQL\MySQL Server 5.7\my.ini the data location was c:\ProgramData\MySQL\MySQL Server 5.7\Data. In fact it was to see, as default proposed data location, during the installation.
This is what worked for me on Windows 7:
c:\ProgramData\MySQL\MySql Server 5.7> xcopy data c:\MySQL\"MySQL Server 5.7"\data\
After that, run MySQL server with:
c:\MySQL\"MySQL Server 5.7"\bin> mysqld
Thanks to those who shared the information that C:\ProgramData was a hidden directory!
If you installed mysql with the MSI installer,
look here: C:\ProgramData\MySQL\MySQL Server 5.7\ and you should see the data folder.
Even thought my datadir is specified to be located in the default mysql server location, my data is stored in %ProgramData%.
Windows version independent answer.
For MySQL 5.7 on Windows, directory for log files and databases is
"%PROGRAMDATA%\MySQL\MySQL Server 5.7\"
The Windows system variable
%PROGRAMDATA% defaults to C:\ProgramData
source: https://dev.mysql.com/doc/refman/5.7/en/windows-installation-layout.html
After changing the directory, the root password is reset. So, keep in mind, if you change the directory, and have access issues, try to access it without a password then set a new password.
For newer users: The data directory lies in C:\Program Files\MySQL\MySQL Server 8.0\data
I currently have MySQL Server 8.0. If you too, are searching for some error solutions and couldn't find the "data" directory for MySQL, here's a note from the official MySQL:
"The default data directory location is C:\Program Files\MySQL\MySQL Server 8.0\data, or C:\ProgramData\Mysql on Windows 7 and Windows
Server 2008. The C:\ProgramData directory is hidden by default. You
need to change your folder options to see the directory and contents."
Hope this clears some hurdles
Take a look at:
C:\Users\All Users\MySQL\MySQL Server 5.1\data