1G内存mysql配置
1G内存mysql配置
1G内存的云服务器,入门级别的配置,数据库的一些参数设置不当的话,经常会出连接数据库失败,或者直接导致数据库崩掉,测试了1G内存配置基本如下:
NO1:找到数据库配置文件my.cnf,一般是在/etc/目录下,看安装mysql时是否有指定其他路径了,自行查找
NO2:[mysqld]下参数
port = 3306
socket = /tmp/mysql.sock
datadir = /mydata
innodb_file_per_table = on
skip_name_resolve = on
key_buffer_size = 8M
max_allowed_packet = 16M
table_open_cache = 128
sort_buffer_size = 2M
read_buffer_size = 1M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 51
#query_cache_size = 100M
max_heap_table_size = 8
open_files_limit = 3072
external-locking = FALSE
tmp_table_size = 16M
max_connections = 521
log_error = /usr/local/mysql/err/err.log
innodb_buffer_pool_size = 64M
NO3:以上参数中有些是新添加的,自行对比完善并测试