0

I'm trying to install MySQL on Raspbian Jessie. This has worked smoothly on another machine with an identical setup; however, on the second one, I can't get it to work.

During package configuration, I get prompted for a password, and after some waiting, I get:

┌─────────────────────────────────────┤ Configuring mysql-server-5.5 ├──────────────────────────────────────┐    
│                                                                                                           │    
│ Unable to set password for the MySQL "root" user                                                          │    
│                                                                                                           │    
│ An error occurred while setting the password for the MySQL administrative user. This may have happened    │    
│ because the account already has a password, or because of a communication problem with the MySQL server.  │    
│                                                                                                           │    
│ You should check the account's password after the package installation.                                   │    
│                                                                                                           │    
│ Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more information.                  │    
│                                                                                                           │    
│                                                  <Ok>                                                     │    
│                                                                                                           │    
└───────────────────────────────────────────────────────────────────────────────────────────────────────────┘    

Digging a bit deeper, I found out that this error was caused by MySQL failing to start. I examined /var/log/mysql/error.log, which has the following entries:

161217 23:33:16 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
161217 23:33:16 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
161217 23:33:17 [Note] /usr/sbin/mysqld (mysqld 5.5.53-0+deb8u1) starting as process 16476 ...
161217 23:33:17 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
161217 23:33:17 [Note] Plugin 'FEDERATED' is disabled.
161217 23:33:17 InnoDB: The InnoDB memory heap is disabled
161217 23:33:17 InnoDB: Mutexes and rw_locks use GCC atomic builtins
161217 23:33:17 InnoDB: Compressed tables use zlib 1.2.8
161217 23:33:17 InnoDB: Using Linux native AIO
161217 23:33:17 InnoDB: Initializing buffer pool, size = 128.0M
161217 23:33:17 InnoDB: Completed initialization of buffer pool
InnoDB: Error: auto-extending data file ./ibdata1 is of a different size
InnoDB: 0 pages (rounded down to MB) than specified in the .cnf file:
InnoDB: initial 640 pages, max 0 (relevant if non-zero) pages!
161217 23:33:17 InnoDB: Could not open or create data files.
161217 23:33:17 InnoDB: If you tried to add new data files, and it failed here,
161217 23:33:17 InnoDB: you should now edit innodb_data_file_path in my.cnf back
161217 23:33:17 InnoDB: to what it was, and remove the new ibdata files InnoDB created
161217 23:33:17 InnoDB: in this failed attempt. InnoDB only wrote those files full of
161217 23:33:17 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
161217 23:33:17 InnoDB: remove old data files which contain your precious data!
161217 23:33:17 [ERROR] Plugin 'InnoDB' init function returned error.
161217 23:33:17 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
161217 23:33:17 [ERROR] Unknown/unsupported storage engine: InnoDB
161217 23:33:17 [ERROR] Aborting

161217 23:33:17 [Note] /usr/sbin/mysqld: Shutdown complete

161217 23:33:18 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

This is not an upgrade but a fresh install (other than that I tried installing MySQL a couple of times, purging mysql-server-5.5 between attempts).

I should mention, however, that I ran out of storage space on the first attempt (the root partition was somewhere short of 2 GB). I tried to fix this by replacing the 2 GB SD card with a 16 GB card, dd'ing the contents of the old one to the new one and extending the partition. Still I can't get it to work, while the first system (which had a 4 GB card from the start) worked just fine. What's the issue here, and how can I fix it?

1 Answer 1

2

Apparently, the issue was caused by lack of storage space during the first attempt: MySQL attempted to create a data file, which failed due to insufficient space and left behind a corrupt data file, as well as a config file pointing to it.

IIRC my first attempt had been to sudo apt-get remove MySQL and reinstall, which left the faulty data file and config behind, so the next install would pick it up and fail in the same way.

Apparently, even a subsequent sudo apt-get purge mysql-server-5.5 did not remove these items. The following sequence of commands finally did the trick for me:

sudo apt-get purge mysql-server-5.5
sudo rm -R /etc/mysql
sudo rm -R /var/lib/mysql
sudo apt-get install mysql-server

After that, MySQL came up and I could log on to the MySQL console.

Important: This will permenently ERASE any and all MySQL data on your system. Do this only on a fresh install, or if you are aware of the consequences.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .