MySQL configurations on 1GB RAM Ubuntu

By default, standard MySQL configurations presume the hosting machine having at least 8GB RAM. If the MySQL hosting machine having RAM lower than 8GB, the MySQL configuration parameters must be adjust to prevent memory over use; otherwise, the MySQL service will go down or be crashed from time to time. Please refer to the following sample settings for /etc/mysql/my.cnf for a VPS machine only having 1GB memory.

$ cat /etc/mysql/my.cnf
 #
 The MySQL database server configuration file.
 #
 You can copy this to one of:
 - "/etc/mysql/my.cnf" to set global options,
 - "~/.my.cnf" to set user-specific options.
  
 One can use all long options that the program supports.
 Run program with --help to get a list of available options and with
 --print-defaults to see which it would actually understand and use.
 #
 For explanations see
 http://dev.mysql.com/doc/mysql/en/server-system-variables.html
 #
 * IMPORTANT: Additional settings that can override those from this file!
 The files must end with '.cnf', otherwise they'll be ignored.
 #
 [mysqld]
 innodb_buffer_pool_size=5M
 innodb_log_buffer_size=256K
 query_cache_size=0
 max_connections=10
 key_buffer_size=1M
 thread_cache_size=0
 host_cache_size=0
 innodb_ft_cache_size=1600000
 innodb_ft_total_cache_size=32000000
 per thread or per operation settings
 thread_stack=131072
 sort_buffer_size=32K
 read_buffer_size=8K
 read_rnd_buffer_size=8K
 max_heap_table_size=16K
 tmp_table_size=1K
 bulk_insert_buffer_size=0
 join_buffer_size=128
 net_buffer_length=1K
 innodb_sort_buffer_size=64K
 settings that relate to the binary log (if enabled)
 binlog_cache_size=4K
 binlog_stmt_cache_size=4K
 !includedir /etc/mysql/conf.d/
 !includedir /etc/mysql/mysql.conf.d/

Add a Comment

You must be logged in to post a comment