ONLY_FULL_GROUP_BY automatically reset by itself? - mysql

I absolutely need to unset ONLY_FULL_GROUP_BY on my VPS server hosted by OVH
So I use the command
mysql > SET GLOBAL sql_mode=(SELECT REPLACE(##sql_mode,'ONLY_FULL_GROUP_BY',''));
found here
But I don't why or who automatically reset this flag the day after.
Could you give me some ideas to find what happens??
Can phpMyAdmin set this mode ??

I had the same issue and solved by using the following tutorial
https://www.sitepoint.com/quick-tip-how-to-permanently-change-sql-mode-in-mysql/

Related

idea [08S01] Communications link failure

I just use IDEA recently and want to use IDEA to connect MySQL(8.0.12).but the IDEA indicate below
However, I use cmd could connect to my database,thus I did not configure out the problem.
I am in serah of many ways to solve this problem on tech forum but those are not working.
change mysql to lower version driver
set time_zone
add properties on url
There are a couple of things to check to solve the 'Communications links' failure.
One thing in particular is to check whether your MySQL server accepts TCP connections. In your terminal, it looks like you are using named pipes.
Make sure your MySQL server allows TCP connections; check for the bind-address configuration in mysql.ini under [mysqld] section. Its value should be at least 127.0.0.1, or set it as * to bind to all (not always a good idea).
Another point is the skip_networking configuration. Check if you have that, and remove and restart MySQL server. I believe this is set by default when you are installing MySQL.
(Also note that 8.0.17 is 'ancient' already).

How to use init_connect in azure database server for mysql

Have created a mysql server which has somehow log_bin set to ON and enforce_gtid_consistency is also set to ON. Now this is causing few issues in my case and i want to turn OFF those variables.
Process i have tried
1. Create a .my.cnf file in user root (~/.my.cnf) and added
[mysqld]
enforce_gtid_consistency=OFF
Result: No changes. It doesnt take effect.
2. In azure portal in init_connect variable i have set "SET enforce_gtid_consistency=OFF;" (because there is no mention of this variable in server parameters).
Result: Cant connect to mysql after setting up value in this parameter.
Is there any way we can fix this?
May be the following doc is helpful:
https://learn.microsoft.com/en-us/azure/mysql/concepts-read-replicas#global-transaction-identifier-gtid
Once GTID is enabled, you cannot turn it back off. If you need to turn GTID OFF, please contact support.

How to enable ONLY_FULL_GROUP_BY in MySQL

I have disabled ONLY_FULL_GROUP_BY by using SET GLOBAL sql_mode=(SELECT REPLACE(##sql_mode,'ONLY_FULL_GROUP_BY',''));. Now I want to restore the default settings.
Is it possible to enable the ONLY_FULL_GROUP_BY in MySQL again?
Thanks in advance
To avoid problems with other configurations, use CONCAT:
SET GLOBAL sql_mode=(SELECT CONCAT(##sql_mode, ',ONLY_FULL_GROUP_BY'));
If you are using Laravel, you could do this on runtime instead of making a global setting
//disable ONLY_FULL_GROUP_BY
DB::statement("SET sql_mode=(SELECT REPLACE(##sql_mode,'ONLY_FULL_GROUP_BY',''));");
//Your SQL goes here - The one throwing the error (:
//re-able ONLY_FULL_GROUP_BY
DB::statement("SET sql_mode=(SELECT CONCAT(##sql_mode, ',ONLY_FULL_GROUP_BY'));");

SET GLOBAL max_allowed_packet doesn't work [duplicate]

This question already has answers here:
How to change max_allowed_packet size
(14 answers)
Closed 1 year ago.
I found out how to change the default value of max_allowed_packet in MySQL using SET GLOBAL. However, each time I used this command, the default value stayed untouched!
I used these commands:
mysql --user=root --password=mypass
mysql> SET GLOBAL max_allowed_packet=32*1024*1024;
Query OK, 0 rows affected (0.00 secs)
mysql> SHOW VARIABLES max_allowed_packet;
And then the result is max_allowed_packet = 1048576. What am I missing?
Hmmmm.. You have hit this NOT-A-BUG it seems. :)
If you change a global system variable, the value is remembered and used for new
connections until the server restarts. (To make a global system variable setting
permanent, you should set it in an option file.) The change is visible to any client that
accesses that global variable. However, the change affects the corresponding session
variable only for clients that connect after the change. The global variable change does
not affect the session variable for any client that is currently connected (not even that
of the client that issues the SET GLOBAL statement).
Refer this too. Read Shane Bester explanation.
You should change from the my.ini/my.cnf file and restart the server for the max_allowed_packet setting to take effect.
After running
set global max_allowed_packet=1000000000;
you have to restart mysql before
SHOW VARIABLES LIKE 'max_allowed_packet'
will show the new value.
I have this issue when restarting mysql through the MAC OSX system preferences and the value hadn't changed. So by logging into mysql via console
mysql -u root -p
changing it and then restarting mySql seemed to work. Might have been a OS X quirk though.
For those with a MariaDb configuration the problem could be that the max_allowed_packet variable is overwritten by a configuration file called later.
In my case I tried to import a database and the server answered me:
ERROR 2006 (HY000) at line 736: MySQL server has gone away
I discovered that the file:
/etc/mysql/mariadb.conf.d/50-server.cnf
is called later
/etc/mysql/conf.d/mysql.cnf
I tried continuously changing in the "mysql.cnf" file but the value was overwritten in "50-server.cnf".
So the solution is to enter the file
/etc/mysql/mariadb.conf.d/50-server.cnf
and instead of
"max_allowed_packet = 16M"
put the desired value as an example
"max_allowed_packet = 64M"
I came across this problem as well and in my case I have multiple versions of MySql installed.
Adding this note for anyone who might have setup MySql using homebrew on mac and are having trouble setting max_allowed_packet value in your my.cnf file.
The most key information that helped was that the my.cnf file can be present in different locations (excerpt from https://github.com/rajivkanaujia/alphaworks/wiki/Install-MySQL-using-Homebrew) -
/usr/local/etc/my.cnf --> Global Access
/usr/local/etc/my.cnf --> Global Access
/usr/local/Cellar/mysql/5.7.18/my.cnf --> Sever Level Access
~/.my.cnf --> User Level Access
Since I installed MySql 5.6 via Home brew I found it at -
/usr/local/Cellar/mysql\#5.6/5.6.43/my.cnf
Steps followed -
Update the /usr/local/Cellar/mysql\#5.6/5.6.43/my.cnf file under [mysqld] group with the necessary max_allowed_packet value -
[mysqld]
max_allowed_packet=5G
Restart mysql using brew services -
brew services restart mysql#5.6
Connect/Reconnect to the mysql shell and verify that the configuration has taken effect using -
show variables like 'max_allowed_packet';
Just a quick way to see the variable for anybody who comes across this. To get the value back you need to run
SHOW VARIABLES LIKE 'max_allowed_packet'

unable Setting mysql wait_timeout variable value

I am trying to set the MYSql environment variable wait_timeout.When I am doing through the mysql prompt using
mysql>set wait_timeout =10;
it gets reflected in the current prompt only and is not reflected globally(from the outside of the current prompt).
I also tried to set it from the outside the mysql prompt using command:
set wait_timeout=10;
but again this didnot worked for me.
I am using Debian(Linux),Please tell me how I can the Wait_timeout so that it would get reflected globally in mysql server.
Did you try setting it in /etc/my.cnf?
See this link for more info. Here's a "non-bug" that explores that setting that might be helpful.
Please use this command "set global wait_timeout =10". It will work.