Ready-To-Go SD card MYSQL problem

I've just put a new Ready-To-Go SD card into a RPi and booted it up. MYSQL fails to start and I get a "cannot connect to database" error when I visit the emoncms web interface.

I can SSH into the pi and have tried to kick start MYSQL but it just fails. I can't find any relevant guides on the website and have found a dead page which looks like it should explain how to set things up but has no content!

Any help please?

Matt

 

 

321liftoff's picture

Re: Ready-To-Go SD card MYSQL problem

I'm having the same issue.  Just started the Jun 17 image.  The webpage results in:

Can't connect to database, please verify credentials/configuration in settings.php
Error message: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Looking at the /var/logs/syslog I see the following:

emonpi mysqld: 150902 2:10:36 InnoDB: The InnoDB memory heap is disabled

emonpi mysqld: 150902 2:10:36 InnoDB: Mutexes and rw_locks use GCC atomic builtins

emonpi mysqld: 150902 2:10:36 InnoDB: Compressed tables use zlib 1.2.7

emonpi mysqld: 150902 2:10:36 InnoDB: Using Linux native AIO

emonpi mysqld: 150902 2:10:36 InnoDB: Initializing buffer pool, size = 128.0M

emonpi mysqld: InnoDB: mmap(135987200 bytes) failed; errno 12

emonpi mysqld: 150902 2:10:36 InnoDB: Completed initialization of buffer pool

emonpi mysqld: 150902 2:10:36 InnoDB: Fatal error: cannot allocate memory for the buffer pool

emonpi mysqld: 150902 2:10:36 [ERROR] Plugin 'InnoDB' init function returned error.

emonpi mysqld: 150902 2:10:36 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

emonpi mysqld: 150902 2:10:36 [ERROR] Unknown/unsupported storage engine: InnoDB

emonpi mysqld: 150902 2:10:36 [ERROR] Aborting

emonpi mysqld:

emonpi mysqld: 150902 2:10:36 [Note] /usr/sbin/mysqld: Shutdown complete

emonpi mysqld:

emonpi /etc/init.d/mysql[3371]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in

emonpi /etc/init.d/mysql[3371]: #007/usr/bin/mysqladmin: connect to server at 'localhost' failed

emonpi /etc/init.d/mysql[3371]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
 

emonpi /etc/init.d/mysql[3371]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld/mysqld.sock' exists!
 

emonpi /etc/init.d/mysql[3371]:

Any advice on getting the June 17 image up and running?

321liftoff's picture

Re: Ready-To-Go SD card MYSQL problem

This seems to be a memory allocation issue: there is not enough RAM for the database to start.  I have an original Raspberry Pi B, which has 512MB of RAM.  By default, there are 6 ramdisks that are created, which on my system total 245MB.  Also, the default GPU RAM allocation is 64MB, so that leaves about 203MB for processes.

The database is trying to allocate 128MB (as seen in the log), and there is just not enough ram for it to do it. The following are some solutions:

  1. reduce the database buffer pool allocation size.
  2. reduce the size of the RAMdisks.  
  3. reduce the GPU RAM allocation from 64MB (default) to 16MB (the minimum).  

I chose #3, since this RPi won't be doing any heavy graphics.  To reduce the GPU RAM, do the following:

sudo nano /boot/config.txt

Then anywhere in the file, add the following line:

gpu_mem=16

That will give the processes an extra 48MB to use.  This was enough for the database to load for me.

Admins, what are your recommendations on freeing up RAM?  Maybe the author of the June 17 SD image has a RaspberryPi 2 B, which has 1024MB of RAM, so this is not an issue?  How can we improve the SD card image for those with smaller amounts of RAM?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.