Ubuntu: Why did installation of MySQL 5.6 on Ubuntu 14.04 fail?



Question:

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:     mysql-server-5.6    E: Sub-process /usr/bin/dpkg returned an error code (1)  

Can anyone see what went wrong?


Solution:1

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


Solution:2

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  

Activate:

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.


Solution:3

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.


Solution:4

In my case I've added

innodb_buffer_pool_size = 20M  

to the /etc/mysql/my.cnf


Solution:5

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

performance_schema=0  

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


Solution:6

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.


Solution:7

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   

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »