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.
Related
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?
I have an Ubuntu 16.04 server (VPS), I installed MariaDb 10.1 on it (did it like the doc said). I would like to configure the database server, so innodb can use 2-4GB memory, so I tried to find the sample my.cnf's in /usr/share/mysql/ but not a single one is there (only these). Where can I find the sample configurations and how can I make them the actual? I read the /etc/mysql/mysql.conf.d/ dir should contain a mysqld.cnf, but for me there are only these files:
50-client.cnf 50-mysql-clients.cnf 50-mysqld_safe.cnf 50-server.cnf 50-server.cnf.backup
Which one is active? My guess is none.
I don't need anything special, that is why I wanted to just actualize the my-huge.cnf and be done.
You need to copy one of those to /etc/my.cnf. Without the file being there, you (probably) have no config other than built-in defaults.
Show us the contents for further critique.
How much RAM do you have?
The most important setting for the server my.cnf is innodb_buffer_pool_size. If you have more than 4GB of RAM, set it to about 70% of available RAM. If you have less than 4GB, use some smaller percentage. Swapping is terribly bad for performance.
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.
I'd like to know if WordPress can be pointed at the DB equivalent of SQL CE. I presume the answer is yes, if MySQL has something equivalent to SQL CE.
What's the low down on this?
Update: Given the answers so far, I will re-state my question so that it is more easily understood: "Can WordPress be pointed at SQLite instead of MySQL?"
I'd like to know if WordPress can be pointed at the DB equivalent of SQL CE
No.
Or at least not easily. WordPress is built on top the LAMP stack where M is strictly MySQL. Although it has a database abstraction layer (WPDB), the code and plugins are littered and accept direct SQL code (MySQL).
If you are interested in this, check out the discussion in the WP Codex.
What is the MySQL Equivalent of SQL CE?
In my opinion, I'd make the jump and say SQLite.
As far as I'm aware there is no MySQL equivalent of SQL Compact Edition. You may want to check SQLite instead (www.sqlite.org). Wordpress supports this.
You may find this surprising but MySQL can be stripped down to operate like a Compact Edition database. MySQL (eh Oracle) does not seem to support the Embedded MySQL anymore (or at least they make hard to find). However, you can make the following tweeks to MySQL:
TWEEK #1 : Disable InnoDB
Start mysqld with this in my.cnf:
[mysqld]
skip-innodb
Benefits
Faster startup of mysql
Does not create ibdata1, ib_logfile0, ib_logfile1
Does not allocate default InnoDB Buffer Pool (MySQL 5.5 128M, before MySQL 5.5 8MB)
Less memory consumption (InnoDB code is not memory resident)
TWEEK #2 : Preload Indexes of the Most Important MyISAM Tables
By default, MyISAM uses the Key Cache and its size is governed by key_buffer_Size. Interestingly, MyISAM allows you to create a dedicate key cache for onr ot more tables.
For example, if you have the table mysite.wp_posts, you can create a dedicated 256M key cache as follows:
SET GLOBAL wp_posts_cache.key_buffer_size = 1024 * 1024 * 256;
CACHE INDEX mysite.wp_posts IN wp_posts_cache;
LOAD INDEX INTO CACHE mysite.wp_posts;
You can have this done at start by doing this:
echo "SET GLOBAL wp_posts_cache.key_buffer_size = 1024 * 1024 * 256;" > /var/lib/mysql/startup.sql
echo "CACHE INDEX mysite.wp_posts IN wp_posts_cache;" > /var/lib/mysql/startup.sql
echo "LOAD INDEX INTO CACHE mysite.wp_posts;" > /var/lib/mysql/startup.sql
Give it a Try !!!
then add this to my.cnf
[mysqld]
init-file=/var/lib/mysql/startup.sql
Then, restart 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.