MySql configuration file does not exist where WorkBench says so - mysql

I'm new to MySql. I have downloaded and installed MySql 5.6 together with the latest version of Workbench (6.2). Workbench says my configuration file is in
C:\Program Files\MySQL\MySQL Server 5.0\my.ini
This folder does not exist. I have
C:\Program Files\MySQL\MySQL Server 5.6
And inside this folder there is an .ini file called my-default.ini. How can I find the correct .ini file so I can change my variables?

The name and path used by MySQL Workbench by default is taken from a template. There are several templates for various server versions and platforms with typical config file locations. However, they may not always work. On Windows however, with standard installations (which are extremely common), there are only very few variations. The simplest way to have the correct config file stored in the connection settings is by changing the installation type in the System Profile settings for a connection:
The sample config file my-default.ini is just that, an example. The installer should have created a concrete config file in the ProgramData MySQL folder for your server, which is what MySQL Workbench will also use by default.

For someone wants to find the menu answered above,
It can be found when you right click on a connection instance box of your MySQL workbench home and go to edit connection.
I know this question posted 5 years ago, but I had looked for the menu as well and finally find it. I hope I can add a comment but I cannot due to the reputation;)

Related

MySQL Workbench Unable to Retrieve Disk Space in Data Dir, Server Stopped

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

Where to find my.ini for Worklight server

I am setting up a worklight server and have followed the steps given in the IBM site. I am now setting up my database using MySQL. And in this link, it said to update the option file. I am not familiar with the option file, but based on research, it is the my.ini file. However, I was not able to locate the file. Anyone knows where I can find this file? thank you!
The my.ini file is a MySQL options file; it has zero relation to Worklight Server.
The fact you're setting up MySQL as the Worklight Server database, does not mean there is a my.ini file for Worklight Server.
So, you need to find the my.ini file for your MySQL installation.
You did not state your MySQL version nor your Operating System, so my suggestion is to search google for
my.ini location <your os> mysql <your-mysql-version>
For example, in Windows for MySQL 5.5 the location would be: %PROGRAMDATA%\MySQL\MySQL Server 5.5\my.ini
See here: http://dev.mysql.com/doc/refman/5.5/en/option-files.html and search for similar based on what you need.

What is the windows path to the MySQL connections file?

I come from the oracle world where the tnsnames.ora file contain all the sql connection information.
I cannot seem to find the file containing such information for mysql. Could someone with a windows machine tell me where I can find it please.
MySQL doesn't need a connections file analogous to the .tns file. MySQL has nothing like a TNS. Connection parameters typically are configured explicitly in your application.
You can optionally create a file called .my.cnf that contains a user's default parameters for connecting.
See also What is the location of mysql client “.my.cnf” in Windows? that shows how to use mysql --help to find out the location of all the config files.
Most people just configure one set of connection parameters in their .my.cnf file, but you can configure multiple sets of connection parameters under different [client] groups, and invoke MySQL client tools to use the respective connection. There's an excellent blog that describes how to set this up here: http://datacharmer.blogspot.com/2011/03/hidden-options-file-trick.html
Re your updated info:
Sorry, I had to boot up a Windows box and install MySQL Workbench to check where the connection info is stored. I don't normally use Windows.
Right, for MySQL Workbench, the connection data is in for example,
C:\Users\Uncle Iroh\AppData\Roaming\MySQL\Workbench\connections.xml
But you're not expected to edit this by hand, and you'll probably ruin it if you try. It's undocumented, and presumably the format could change if you change versions of MySQL Workbench. You should create or edit connections in the Workbench GUI.
There is no such thing in MySQL. Check for a config file called my.ini or my.cnf. If MySQL is using a non-default port (not 3306), it will be detailed there. Otherwise, connect using:
mysql -u user -p
This is an executable (mysql.exe) you'll find in the bin directory of the installation (probably). For example, on my Windows box it's here: C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin\mysql.exe

Is the file "my.ini" in the wrong place?

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

MySQL my.ini location

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.