MySQL 8.0.3 defaults file missing in a running instance - mysql

Due to some configuration issue, I found out that I need to change a MySQL server parameter. However, MySQL was running in Windows "Services" as "C:\MySQL\bin\mysqld MySQL" which I understand does not provide a "defaults-file".
My question is,
Is there a default "defaults file" ? I searched for any *.ini or *.cfg file and could not find any.
Is there a sample file for this version I can download somewhere ? I tried some old files but there are some compatibility issues with previous versions.
Thanks in advance

MySQL Server has "default defaults" built-in. No options file is necessary to get these defaults.
You can find all the default values for every option in the manual: https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html
It's recommended to leave the defaults alone unless you have a specific reason to change one. Then make your own edits to your local options file.
It's a good idea to add comments to the options file so you have a record of why you changed each value away from its built-in default.

Related

How does my.ini get generated when installing a MySQL server?

Is there any documentation as to how my.ini gets generated ? I cannot find it in the official docs.
I have had problems with some installations having NO_ZERO_DATE in sql_mode, and others not.
I keep trying different installation options to not have NO_ZERO_DATE, but cannot manage it.
The docs state that NO_ZERO_DATE is included by default, but I just did an install on a brand-new computer, and it wasn't included. There are too many options to narrow it down without the process taking days.

"Packet for query is too large" error. Where to change max_allowed_packet variable?

I am having a problem, I imported a spring boot project from git, the code is working perfectly fine in my teammates computers, but I get an error That I don't know how to solve, while running my java application I get this error :
Packet for query is too large (1072729 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable.
I read some answers about the subject, What I understood is that I have to make a change in my.ini file and change this value :
max_allowed_packet=500M
But it seems like I am unable to find my file location, I am working with MySQLWorkebench and I dont know where to find this file to make my change or any change.
Any help would be much appreciated.
You will find my.ini in either
32bit WAMPServer
C:\wamp\bin\mysql\mysqlx.y.z\my.ini
64bit WAMPServer
C:\wamp64\bin\mysql\mysqlx.y.z\my.ini
where mysqlx.y.z is the version of MySQL that you have installed. Remember there may be more than one version installed so check with the wampmanager icon menu which one is currently active
In my.ini under the section [wamp] or [wamp64] you will see the parameter
max_allowed_packet = 1M
Change that to the value you believe is required.
Remember to restart MySQL (using the wampmanager icon menus) after saving your change to my.ini

Change Xampp Mysql to display errors in Portuguese

I'm trying to change mysql to return the error in Portuguese.
I already added in the file my.ini the line "lc-messages = pt_BR"
It still keeps returning the error in English.
Does anyone know how to help me in this?
Before I came to ask for help I already researched and could not solve this
My version of Xampp is v3.2.1
PS: Sorry for the English
Changing the language is not so much a XAMPP nor PHP thing but rather involves a MySQL configuration file aka an option file. Take a look here. You should change your my.ini file to include this server command option:
lc-messages=pt_BR
If you are using XAMPP 3.2.1, then you most likely are using MySQL5.6 and the correct way to express this locale change option is to write "lc-messages", i.e. use a hyphen and not an underscore in an option file or on the commandline; see here.
Be sure to save the file and then you should restart the MySQL server.
Note: the actual environment variable is lc_messages.

How to restore MySQL workbench session and retrieve the SQL tabs back?

Usually MySQL workbench would load up all existing SQL tabs whenever I clicked on connection.
Today I tried and it is not loading my existing session back and I don't have any backup of my SQL code I wrote on workbench.
Is there any way to retrieve the session back or restore the last session with all the TABS?
I found this Googling as was also looking for code I'd neglected to save before closing Workbench. It wasn't in the sql_workspaces but I found it logs all queries actually executed in this file and was able to pull what I needed from there:
\%APPDATA%\MySQL\Workbench\log\sql_actions_unconnected.log
If you use a Mac and have TimeMachine I found that I could go back to the old version of the folder where it was stored and restore
~[user]/Library/Application Support/MySQL/Workbench/sql_workspaces/
Each directory below that is an instance of a saved work environment and restoring the directory allowed Workbench to reopen it when I reopened the connection. Phew!
(Library is a hidden folder).
Enable Edit>Preferences>SQL Editor>Save snapshot of open editors on close.
Even with this option checked, I experienced your problem with Workbench 6.0.X so I updated to latest version (6.3.X) and it was solved. I think there was a bug.
If the save snapshot option is enable then you can find the data in
\%APPDATA%\MySQL\Workbench\log\sql_actions_unconnected.log
If nothing else, you can at least try and recover the tab contents manually as described here.

MySQL binary log location Windows 2008 Server

I'm running a Windows 2008 Server with IIS, PHP and MySQL. MySQL is installed as a service. There's software on the server that uses a database that I need good backups of, including transaction logging. I've turned on Binary Logging via setting log-bin= and expire_logs_days= in the my.ini file. This saves those logs in the MySQL data folder on that drive. If I lose the drive, I lose my logs and they've done me no good as a backup.
I've found all kinds of advice for relocating these logs on a Linux box, but trying to use the same idea of including a path in the log-bin statement is not working. I've tried "flipping" the slashes, adding quotes and the common other attempts when "translating" Linux to Windows.
I created a mapped drive to the external location to make this easier, and I've tried using \server\folder path statements as well as z:\ path statements.
Any help would be greatly appreciated.
If you made your changes in the [mysqld] section in the my.ini file then you should be good. The correct path naming convention, should look something like this log-bin="C:/yourfilepathname/logs". Since you are still experiencing issues, Please check to make sure that mysql has permission to write to the directory that you are specify the logs files to be written to.
Another way you can check if this is the issue, go to your .err log file when you try to stop and start mysql server it will tell you something along the lines of not having permission to write to that directory.
Also, I would note that log bin files in it of themselves are not a backup. You need to be taking mysqldumps or snapshots of the entire directory from your server, preferably from a slave of your master production server.
You are missing a trailing slash.
Here is what's in my my.ini (I'm using MariaDB 10.1, but I believe this will work for you also):
[mysqld]
datadir=D:/mysql-data
log-bin=E:/mysql-bin/
When I left out the trailing slash in the log-bin setting, I also got the same error in logs, and the service failed to start. After adding the slash, no errors, and the service started successfully.
I now see files getting created in E:\mysql-bin, such as .index, .000001.
make sure you are ending with filename. see below.
log-bin=C:/Program Files/MySQL/MySQL Server 5.6/data/bin.log
Actually it's due to using the normal windows backslashes. Instead of z:\ use z:/ (forward slash). Also if you don't end with a forward slash then it will use the last part as the file name. Exp:
z:/bin-logs/ (this will have files named .index and .000001)
z:/bin-logs/log (this will have files named log.index and log.000001)