Change MySQL innodb_buffer_pool_size at runtime? - mysql

This may be a dumb question, but is it possible to change the MySQL configuration options such as innodb_buffer_pool_size at runtime?
Or, equivalently, is there a way to reload MySQL without closing existing connections or refusing new connections (like you can do with Apache)?
Linux_32 (2.6.26) + MySQL 5.0.24a

According to this MySQL forum post, it is not possible to set innodb_buffer_pool_size at runtime.
So the question remains: is it possible to change the MySQL configuration and reload the daemon transparently to its users?

Yes, you can (depending on your server version).
The innodb_buffer_pool_size is a dynamic variable since 5.7.5 as this manual entry says.
Here is some further information about the server's behaviour when changing the size.

Related

Regarding mysql limits

I read something about updating globals such as net_read_timeout, connect_timeout etc to avoid lost connection on MySQL databases. So my question is simply this
If I execute these queries, do I have to restart mysql service on Ubuntu & Nginx?
SET GLOBAL connect_timeout=28800
SET GLOBAL net_read_timeout=600
My question is really because when I use this query, it seems like they updated, but are they operating even though I don't restart mysql service etc?
SHOW VARIABLES LIKE '%timeout%'
Yes, they will definitely work. Only 'certain' OS's need rebooting after minor changes (I'm staying neutral). But don't take my word for it, see:
https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html
It says:
Most of them can be changed dynamically at runtime using the SET
statement, which enables you to modify operation of the server without
having to stop and restart it.
Then look in the table further down and you can see that connect_timeout and net_read_timeout are both dynamic.
I guess that the documentation has a purpose after all?

MySQL my.cnf config setup for MyISAM

I currently have a Cloud based server with the following config.
CentOS 7 64-Bit
CPU:8 vCore
RAM:16 GB
MariaDB/MySQL 5.5.5
Unfortunately, I've inherited a MyISAM database and tables that I have no control to convert to INNODB even though the application performs many writes from many connections. The data is Wordpress Posts with the typical large text and photos.
I'm experimenting with my.cnf config changes and was wondering if the config I've developed here is making use of the resources in the most effecient way. Is there anything glaring I could increase/decrease to squeak out more performance?
key_buffer_size=4G
thread_cache_size = 128
bulk_insert_buffer_size=256M
join_buffer_size=64M
max_allowed_packet=128M
query_cache_limit=128M
read_buffer_size=16M
read_rnd_buffer_size=16M
sort_buffer_size=16M
table_cache=128
tmp_table_size=128M
This will depend entirely on the type of data you are storing, the structure and size of your tables and the type of usage your database has. Not to mention the amount of available RAM and the type of disks your server has.
The best recommendation, if you have shell access to the server (which I assume you must, otherwise you couldn't change my.cnf) is to download the mysqltuner script from major.io
Run this script as a user with privileges to access your database, and preferably with root privileges on mysql too (the ideal is to run it under sudo or root) and it will analyse your database access since mysql's last restart, and then give you recommendations to change the options in my.cnf
It isn't perfect, but it'll get you much further, and more quickly, than anyone on here trying guess what values would be appropriate for your use case.
And, while not trying to pre-empt the results, I wouldn't be surprised if mysqltuner recommends that you drastically increase the size of your join buffer, table_cache and query_cache_limit.

Mysql my.cnf empty and mysqltuner

I'm trying to solve a performance issue I have on a Mysql database and to do that I'm using mysqltuner.
What I don't understand is why in phpmyadmin and mysqltuner I have several variable mentioned, whereas when I open the my.cnf file is almost empty. There is the maxconnections parameter only.
Where are stored the other variables ???
Other variables are defaults.
My.cnf only override defaults.
You can look for defaults here: https://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Most of what mysqltuner comes from
SHOW GLOBAL VARIABLES;
SHOW GLOBAL STATUS;
my.cnf is merely the overrides to the default static VARIABLES built into the server. STATUS are counters, etc that change over time.
Note the word GLOBAL. Those are the defaults for the corresponding SESSION values that belong to your connection. The VARIABLES you change in phpmyadmin, will not be permanent. You have to edit my.cnf and restart mysqld to get permanent changes.
Usually you cannot tune your way out of a performance problem. Once you have the main cache size set (which engine are you using? how much ram do you have?), not much other tuning is worth doing.
The main performance gains are from improving the queries and/or the schema, such as adding composite indexes. Let's see a slow query, and we can discuss this further.
MysqlTuner is reading variables and status at the runtime.

MySql innodb_buffer_pool_size for improving performance

Can we set MySql innodb_buffer_pool_size dynamically ?
We can do the same at startup my modifying the my.cnf.
In short: no, it is only a server startup parameter (according to this manual page).
You can find all dynamic system variables here (for version 5.1):
http://dev.mysql.com/doc/refman/5.1/de/dynamic-system-variables.html
Currently not. But it will be possible in 5.7:
https://dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool-online-resize.html
Older versions need a restart to change that setting.

updating a mysql config variable (ft_min_word_len)?

I need to set ft_min_word_len = 3.
I never restarted my mysql server on my production server. So I fear this moment :).
Are there any way to set ft_min_word_len = 3 without restarting mysql?
And if i must restart it, can you tell me the exact step I have to do?
I am on Devian GNU/Linux
MySQL: 5.0.32
(where I can find where is the mysql configuration file?)
Thanks a lot
No, I'm afraid you need to restart MySQL for it to accept the change. That said, there's nothing to be afraid of, as this won't affect any data. (If you're feeling paranoid, simply carry out the change/restart at an off-peak time, when site traffic is low.)
In terms of the configuration file, I think it lives in /etc/mysql/my.cnf on Debian. (If not, check /etc/my.cnf.)
To restart the service, simply issue a "/etc/init.d/mysql restart" command and all should be well.