Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The MySQL daemon on my CentOS server keeps crashing, i got the logs from /var/logs/mysqld but still i am not sure how to fix this:

    121114 16:22:56 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended                                                                                                 
    121114 21:55:11 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql                                                                                             
    121114 21:55:11 [Note] Plugin 'FEDERATED' is disabled.                                                                                                                            
    121114 21:55:11 InnoDB: The InnoDB memory heap is disabled                                                                                                                        
        121114 21:55:11 InnoDB: Mutexes and rw_locks

 use GCC atomic builtins                                                                                                              
    121114 21:55:11 InnoDB: Compressed tables use zlib 1.2.3                                                                                                                          
    121114 21:55:11 InnoDB: Using Linux native AIO                                                                                                                                    
    121114 21:55:11 InnoDB: Initializing buffer pool, size = 128.0M                                                                                                                   
    121114 21:55:11 InnoDB: Completed initialization of buffer pool                                                                                                                   
    121114 21:55:11 InnoDB: highest supported file format is Barracuda.                                                                                                               
    InnoDB: The log sequence number in ibdata files does not match                                                                                                                    
    InnoDB: the log sequence number in the ib_logfiles!                                                                                                                               
    121114 21:55:11  InnoDB: Database was not shut down normally!                                                                                                                     
    InnoDB: Starting crash recovery.                                                                                                                                                  
    InnoDB: Reading tablespace information from the .ibd files...                                                                                                                     
    InnoDB: Restoring possible half-written data pages from the doublewrite                                                                                                           
    InnoDB: buffer...                                                                                                                                                                 
    121114 21:55:12  InnoDB: Waiting for the background threads to start                                                                                                              
    121114 21:55:13 InnoDB: 1.1.6 started; log sequence number 77177262                                                                                                               
    121114 21:55:13 [Note] Event Scheduler: Loaded 0 events                                                                                                                           
    121114 21:55:13 [Note] /usr/libexec/mysqld: ready for connections.                                                                                                                
    Version: '5.5.12'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL) by Remi                                                                          
    121115 00:19:44 mysqld_safe Number of processes running now: 0                                                                                                                    
    121115 00:19:44 mysqld_safe mysqld restarted                                                                                                                                      
    121115  0:19:47 [Note] Plugin 'FEDERATED' is disabled.                                                                                                                            
    121115  0:19:47 InnoDB: The InnoDB memory heap is disabled                                                                                                                        
    121115  0:19:47 InnoDB: Mutexes and rw_locks use GCC atomic builtins                                                                                                              
    121115  0:19:47 InnoDB: Compressed tables use zlib 1.2.3                                                                                                                          
    121115  0:19:47 InnoDB: Using Linux native AIO                                                                                                                                    
    121115  0:19:47 InnoDB: Initializing buffer pool, size = 128.0M                                                                                                                   
    InnoDB: mmap(137363456 bytes) failed; errno 12                                                                                                                                    
    121115  0:19:47 InnoDB: Completed initialization of buffer pool                                                                                                                   
    121115  0:19:47 InnoDB: Fatal error: cannot allocate memory for the buffer pool                                                                                                   
    121115  0:19:47 [ERROR] Plugin 'InnoDB' init function returned error.                                                                                                             
    121115  0:19:47 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.                                                                                                  
    121115  0:19:47 [ERROR] Unknown/unsupported storage engine: InnoDB                                                                                                                
    121115  0:19:47 [ERROR] Aborting  

Edit #1

             total       used       free     shared    buffers     cached                                                                                                         
Mem:           496        370        126          0         24        110                                                                                                         
-/+ buffers/cache:        234        261                                                                                                                                          
Swap:         1023          9       1014  

Edit #2

Also, largest table in my mysql is 20MB, so my the memory used should be pretty moderate.

SELECT CONCAT(table_schema, '.', table_name),
       CONCAT(ROUND(table_rows / 1000000, 2), 'M')                                    rows,
       CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G')                    DATA,
       CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G')                   idx,
       CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
       ROUND(index_length / data_length, 2)                                           idxfrac
FROM   information_schema.TABLES
ORDER  BY data_length + index_length DESC
LIMIT  10;

enter image description here

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted
InnoDB: Fatal error: cannot allocate memory for the buffer pool

from the looks of it your server cannot allocate enough memory for innodb.

Write free -m to see how much memory you have to allocate. Have a look in your /etc/my.cnf and have a look at the innodb_buffer_pool_size make changes.

If you want, you can start mysql without innodb which some people do to lower the memory footprint. mysqld --skip-innodb --default-storage-engine=myisam

share|improve this answer
    
but i have very small databases and low traffic, i dont think it would take over all the memory, i added the free -m output to the question: –  Yehia A.Salam Nov 15 '12 at 10:36
    
The reason mysql is not starting is in your error log Fatal error: cannot allocate memory for the buffer pool. This is down to the memory being allocated for innodb higher than what is available to the system. Output your free -m and innodb_buffer_pool_size here and will be able to help you further if need be :) –  Sc0rian Nov 15 '12 at 10:39
    
just added the edits to the question –  Yehia A.Salam Nov 15 '12 at 10:51
    
121114 21:55:11 InnoDB: Initializing buffer pool, size = 128.0M –  David Schwartz Nov 15 '12 at 11:31
    
it was an apache problem, apache was trying to get more resources –  Yehia A.Salam Jan 5 '13 at 12:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.