group_concat_max_len value gets changed to default on restart - mysql

I am changing the value of group_concat_max_len to 15000 using
SET group_concat_max_len=15000;
I achieve what I what but when I restart mysql server, it is set to default 1024.
How can I make it static to 15000, I assume, I should be able to set this value in mysql config file. I added group_concat_max_len=15000 in my.cnf and restarted the server. The value remained same i.e 1024.
Can I set it in a way so that the value remains same when mysql server is restarted?

Yes. You need to put it in the config file :
LINUX: my.cnf file
WINDOWS: my.ini file
[mysqld]
group_concat_max_len=15000
Note: Add this line group_concat_max_len=15000 under mysqld section. You need to restart your MySQL server to see the effect.

Related

Innodb_buffer_pool_size not set

I am trying to update MySQL "innodb_buffer_pool_size" in windows server. I have run "set global innodb_buffer_pool_size=25610241024".
After I restart the server it's set back to 8M again.
If I change my.ini file then MySQL57 service is not running.
I am using MySQL 5.7.36.
To save setting, you need to put them in a my.ini file that the mysql server reads on startup.
SET GLOBAL... only affect the current running instance.

Mysql : can't set lower_case_table_names variable

I'm installing new software on a new Ubuntu 16.0.4 machine and installed MySQL with apt-get. The version I get is 5.7.22 but can't get it to accept
my settings of the configuration variable lower_case_table_names.
I'm adding lines like:
[mysql]
lower_case_table_names = 1
When I edit any of the *.cnf files in /etc/mysql to have this setting or if I add it to ~/.my.cnf I get
mysql: [ERROR] unknown variable 'lower_case_table_names=1'
if I try to start mysql. Similarly I can't use it on the mysql command line like the doc says I can.
/usr/bin/mysql --lower_case_table_names=1 -u root -p
However:
If I go into the SQL command interpreter and type
mysql> select ##lower_case_table_names;
I get back a result showing the variable is set to 0. However it cannot be changed with a SET statement...
So whats the deal with why I can't set this variable ?
~/.my.cnf file:
[mysqld]
lower_case_table_names = 1
[mysql]
lower_case_table_names = 1
Why is mysql not liking this variable name when clearly it still has a setting for it?
The problem is that this variable does not apply to mysql. It only applies
to mysqld. Stop mysqld, change the my.cnf to have a setting for [mysqld], and then start mysqld. This will set the lower_case_table_names value for the mysql server.
If you run /usr/bin/mysql (a command line mysql shell) it will not want a setting for this var in the config file. The shell will behave as the mysql server behaves.

Unable to set sql_mode in my.cnf

I want to set sql_mode to NO_ENGINE_SUBSTITUTION only.
I modified my.cnf and added this line:
sql_mode=NO_ENGINE_SUBSTITUTION
restarted mysql service but when I execute this query:
show variables like '%sql_mode%'
that's what I get:
How can I fix this issue? I am using vps bought via godaddy.
It's possible to set sql_mode for the session.
SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION'
You can verify the setting with the SHOW VARIABLES statement.
To change the global setting:
SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION'
To have the global setting initialized when the MySQL server restarts, the setting can be configured in the configuration file(s) e.g. my.cnf.
I believe that setting needs to be under the [mysqld] section of the configuration file. Note that there may be more than one configuration file being read. There might be a /usr/my.cnf file that contains a setting.
The sql_mode can also be specified as an option on the mysqld startup command line.
Reference:
http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html

Set a persistent global MySQL parameter

I set the following MySQL parameter:
set global wait_timeout=2147483
However, after server restart it reverted to its default value 28800. Isn't the set command persistent? In order to have this parameter persistent, should I edit a configuration file? Would that file be C:\Program Files\MySQL\MySQL Server 5.5\my.ini? If so, is it simply
wait_timeout=2147483
If so, under which section should it be in my.ini
Set global doesn't make persistent variables.
You should write that under [mysqld] section in my.cnf:
[mysqld]
wait_timeout=86400

how to permanently activate/set the global event_scheduler to 1 in mysql

I have added a event to my mySQL db and it works fine, but the thing that is bothering me is that every now and then I have to set the mysql global variable to 1 so that my event is active.I log in as root user and have complete privileges (I use it for practice purpose)
Every time I log in to my mysql server I have to execute the following line
__set global event_scheduler=1__
can I set the event_scheduler variable permanently to 1?
I'm using mysql 5.1.50 - community
Yes, write event_scheduler=on somewhere under the [mysqld] section in the default mysql config file, usually /etc/my.cnf
If you are using WAMP :
Open its control panel by clicking on the WAMP icon -> mysql-> my.ini
Its location may be at:
C:\wamp\bin\mysql\mysql{your.ver.sion}
Add EVENT_SCHEDULER=ON under [mysqld] - not [mysql] notice the "d" for daemon. Another tip to ascertain where you're adding is where your (default) server port is specified.
[mysqld]
port=3306
event_scheduler=on