2015-02-09 68 views
0

我希望大家都很好。我的雲服務器上有一個問題,有2GB內存和40GB硬盤,它們託管着一個每天接收大約1000-2000次點擊的Wordpress網站。我的問題是,MySQL總是崩潰,我唯一的選擇是重新啓動服務器。我注意到,日誌未啓用,所以我使他們在這裏是我發現:如何永久解決MySQL錯誤2002(HY000)

150207 17:31:42 [Note] Plugin 'FEDERATED' is disabled. 
150207 17:31:42 InnoDB: The InnoDB memory heap is disabled 
150207 17:31:42 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
150207 17:31:42 InnoDB: Compressed tables use zlib 1.2.3.4 
150207 17:31:42 InnoDB: Initializing buffer pool, size = 1.2G 
InnoDB: mmap(1285636096 bytes) failed; errno 12 
150207 17:31:42 InnoDB: Completed initialization of buffer pool 
150207 17:31:42 InnoDB: Fatal error: cannot allocate memory for the buffer pool 
150207 17:31:42 [ERROR] Plugin 'InnoDB' init function returned error. 
150207 17:31:42 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 
150207 17:31:42 [ERROR] Unknown/unsupported storage engine: InnoDB 
150207 17:31:42 [ERROR] Aborting 
150207 17:31:42 [Note] /usr/sbin/mysqld: Shutdown complete 

我猜這事做內存分配或在我的my.cnf文件的一些設置。這些是內容:

[client] 
port       = 3306 
socket       = /var/run/mysqld/mysqld.sock 

[mysqld_safe] 
socket       = /var/run/mysqld/mysqld.sock 
log_error      = /var/log/mysql/mysql_error.log 

[mysqld] 
user       = mysql 
pid-file      = /var/run/mysqld/mysql.pid 
socket       = /var/run/mysqld/mysqld.sock 
port       = 3306 
datadir      = /var/lib/mysql 
thread_cache_size    = 4 
table_open_cache    = 800 
table_cache     = 800 
key_buffer      = 32M 
query_cache_type    = 1 
query_cache_size    = 64M 
query_cache_limit    = 8M 
innodb_buffer_pool_size  = 1G 
innodb_io_capacity    = 2000 
innodb_read_io_threads   = 64 
innodb_thread_concurrency  = 0 
innodb_write_io_threads  = 64 
log_error      = /var/log/mysql/mysql_error.log 
slow_query_log     = 1 
slow_query_log_file   = /var/lib/mysql/ib_slow_log.log 

任何幫助將不勝感激。

問候!

+0

你可能會做的更好,詢問關於[dba.se] – 2015-02-09 04:49:11

+0

感謝@HoboSapiens,讓我這樣做。非常感謝! – realnsleo 2015-02-09 07:28:04

回答

0

我知道這是舊的,但我想分享一些簡單。我只需要將我的服務器RAM升級到4GB,並相應地將我的key_buffer,query_cache_size加倍。從那時起,我的MySQL數據庫中沒有崩潰。謝謝!