I wanted to get a look at MySQL 5.6 on Ubuntu 14.04 just out of curiosity. And based on this article it certainly looked like installation should be simple and straightforward. So I fired up an AWS EC2 micro server running Ubuntu 14.04 (64-bit), logged into my pristine instance (via PuTTY), and issued the following commands:

$ sudo apt-get update
$ sudo apt-get build-dep mysql-server-5.6
$ sudo apt-get install mysql-server-5.6

(The first two commands were desperation moves, since simply running apt-get install alone had previously not worked. But even with all three commands, the install step still did not work.)

At the point where I expected, based on the article referenced above, to see this output from the final command:

mysql start/running, process 2355  
Setting up libhtml-template-perl (2.95-1) ...  
Setting up mysql-common-5.6 (5.6.16-1~exp1) ...  
Processing triggers for libc-bin (2.19-0ubuntu6) ...  
Processing triggers for ureadahead (0.100.0-16) ...  

I got this instead:

start: Job failed to start  
invoke-rc.d: initscript mysql, action "start" failed.  
dpkg: error processing package mysql-server-5.6 (--configure):  
 subprocess installed post-installation script returned error exit status 1  
Setting up libhtml-template-perl (2.95-1) ...  
Setting up mysql-common-5.6 (5.6.16-1~exp1) ...  
Processing triggers for libc-bin (2.19-0ubuntu6) ...  
Processing triggers for ureadahead (0.100.0-16) ...  
Errors were encountered while processing:  
E: Sub-process /usr/bin/dpkg returned an error code (1)

Can anyone see what went wrong?


7 Answers 7


I have encounter the same problem when I init my small VPS. The issue is caused by small memory. So without spending extra money to increase the memory which you not needed, you could simply create swap files to aids the installation. Yes the swap is slow, but all you need is get the install done.

On Ubuntu 14.04, I do the following to solve the problem:

Create a 4G swap file:

sudo fallocate -l 4G /swapfile

Change its permission to only root could access and change:

sudo chmod 600 /swapfile

Make it swap:

sudo mkswap /swapfile


sudo swapon /swapfile

Now you can try install mysql again, it should success this time. Just remember to remove the previous unsuccessful installation before you do so.

  • Yup, perfect answer. Absolutely awesome.
    – Wren
    Dec 5, 2016 at 6:33

The problem you are having looks the same as this bug report. The failure to start seems to be because the default MySQL 5.6 configuration requires more memory than it can get in your micro instance.

The solution to the error appears to be to do one of the following:

  • Increase the amount of memory in your EC2 instance
  • Set a smaller value for MySQL's max_connections variable
  • 1
    Yes, this problem is EXACTLY the error shown in that bug report. Thanks! So far I tried the quick fix suggested, which was to insure that /etc/apparmor.d/local/usr.sbin.mysqld existed, and unfortunately that didn't do it. So now I will try an installation with more memory.
    – WebLearner
    Apr 29, 2014 at 22:20
  • 1
    For the next try, instead of using an EC2 instance, I created an Ubuntu 14.04 virtual machine with 2GB of memory using the Oracle VM Virtualbox, and in this environment the MySQL 5.6 installation sailed through without a hitch using sudo apt-get install mysql-server-5.6. So it certainly appears that an EC2 micro instance does not have enough memory to install MySQL 5.6 using apt-get!
    – WebLearner
    Apr 29, 2014 at 22:51
  • 1
    An additional comment was added to the bug report that suggested reducing MySQL's max_connections prior to installing MySQL 5.6. I took that advice and added a .cnf file to /etc/mysql/conf.d that contained two lines: "[mysqld]" and "max_connections = 20". With that file in place, my MySQL installation on a fresh EC2 micro sailed through. (According to the documentation the default value for max_connections is 151. Setting it to 20 is probably extreme. But at least it shows that it's possible to get MySQL to install.)
    – WebLearner
    May 5, 2014 at 16:41
  • For additional info: I check /var/lib/dpkg/info/mysql-server-5.6.postinst and I found that you can run that script for reproduce the exact steps that are failing
    – shakaran
    Oct 29, 2015 at 19:11
  • It's working on my vagrant, I has set the 1G RAM and fixed it. thank you. :D Oct 20, 2016 at 10:41

I have encounter the same problem. Though i had the big enough memory 12Gb given to my VM, but still things were failing as in question. After spending some time found that default apt get was missing some of the configuration translation and tool translation packages.

The MySQL apt repository provides a simple and convenient way to install and update MySQL products with the latest software packages using apt-get. Here is what you have to follow:

  1. Adding the MySQL APT Repository First, add the MySQL apt repository to your system's software repository list. Follow these steps:

    • Go to the download page for the MySQL apt repository at http://dev.mysql.com/downloads/repo/apt/.

    • Select and download the release package.

    • Install the downloaded release package with the following command, replacing version-specific-package-name with the name of the downloaded package (preceded by its path, if you are not running the command inside the folder where the package is):

      sudo dpkg -i /PATH/version-specific-package-name.deb

    Note that the same package works on all supported Debian and Ubuntu platforms.

    • During the installation of the package, you will be asked to choose the versions of the MySQL server and other components (for example, the MySQL Workbench) that you want to install. If you are not sure which version to choose, do not change the default options selected for you. You can also choose none if you do not want a particular component to be installed. After making the choices for all components, choose OK to finish the configuration and installation of the release package.

    you can always change your choices for the versions later;
    see Selecting a Major Release Version for instructions.

    • Update package information from the MySQL APT repository with the following command (this step is mandatory):

      sudo apt-get update
  2. Installing MySQL with APT

    • Install MySQL by the following command:

      sudo apt-get install mysql-server

This installs the package for the MySQL server, as well as the packages for the client and for the database common files.

During the installation, there are two requests by the dialogue boxes: Supply a password for the root user for your MySQL installation.

  1. Starting and Stopping the MySQL Server

The MySQL server is started automatically after installation. - You can check the status of the MySQL server with the following command:

sudo service mysql status
  • Stop the MySQL server with the following command:

    sudo service mysql stop
  • To restart the MySQL server, use the following command:

    sudo service mysql start

I followed this http://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#apt-repo-fresh-install. This worked smoothly and downloaded all packages and successfully installed mysql 5.6.

  • Thanks David. This make sense. I have changed the answer to more detailed steps. Thanks.
    – Ritesh
    May 7, 2016 at 7:55
  • +1 for the improved answer. May 7, 2016 at 8:19
  • last was me … it is really me? :)
    – swift
    May 7, 2016 at 15:46

In my case I've added

innodb_buffer_pool_size = 20M

to the /etc/mysql/my.cnf

  • 1
    The user is having issues getting MySQL installed, not using it.
    – user323419
    Feb 16, 2016 at 18:09
  • Thanks, I have read the question) I got the same problem during installation. Actually the installation finished and mysql already accessible as service, and we could run it. But on last step of the installing process (starting mysqld) we catch this annoying error. Feb 16, 2016 at 20:13

Disabling the performance_schema also saves a lot of memory. My empty database going from 400m to 40m on startup:


MySQL Docs: http://dev.mysql.com/doc/refman/5.6/en/performance-schema.html


I encountered this issue on Ubuntu 15.10. For me it was not a memory issue (I have 2GB ram and 18GB of swap, of which only about 300MB was used in total).

In my case, dpkg was looking for /etc/mysql/conf.d, which did not exist (however /etc/mysql/mysql.conf.d did!). Reinstalling mysql and manually creating the folder /etc/mysql/conf.d solved my issue.

How exactly did this happen? I have no idea. I almost didn't want to share my answer, as I bet this solution is specific to my computer.

I solved this issue by using the utility strace, which is fantastic for this sort of thing, if incredibly verbose.

I used it like this:

  • After pressing ctrlc halfway through apt-get install mysql-server, I had to run dpkg --configure -a to finish the installing.

  • I ran strace 2>/tmp/trace dpkg --configure -a. That made me a nice strace log at /tmp/trace.

  • I looked through the log, especially down the bottom, where it failed.

  • I noticed it tried to access /etc/mysql/conf.d, and got the error code ENOENT, no such file or directory.

For anyone wanting to give this a go, do the strace 2>/tmp/trace (command) and grep for ENOENT. As I said, this solution is probably specific to my computer, but you might want to give it a go.


In my case all I needed to do was make some changes in my.cnf and just delete 2 logs files named ib_logfile0 and ib_logfile1, and start mysql

service mysql start

No need to reinstall mysql, just delete these 2 log files and restart mysql server

Below changes I made in my.cnf:

max_connections     = 1000     
max_allowed_packet  = 1024M
wait_timeout        = 7200 
  • Please add a bit more to your answer so others can follow. Jan 5, 2017 at 10:09

You must log in to answer this question.

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