Why did installation of MySQL 5.6 on Ubuntu 14.04 fail?
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:
-
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
-
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.
- 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
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 rundpkg --configure -a
to finish the installing.I ran
strace 2>/tmp/trace dpkg --configure -a
. That made me a nicestrace
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.
WebLearner
Updated on September 18, 2022Comments
-
WebLearner over 1 year
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?
-
Admin almost 8 years
-
-
WebLearner about 10 yearsAn 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.)
-
shakaran over 8 yearsFor 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
-
Admin over 8 yearsThe user is having issues getting MySQL installed, not using it.
-
maxkoryukov over 8 yearsThanks, 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.
-
Ritesh about 8 yearsThanks David. This make sense. I have changed the answer to more detailed steps. Thanks.
-
David Foerster about 8 years+1 for the improved answer.
-
swift about 8 yearslast was me … it is really me? :)
-
Chu-Siang Lai over 7 yearsIt's working on my vagrant, I has set the 1G RAM and fixed it. thank you. :D
-
Wren over 7 yearsYup, perfect answer. Absolutely awesome.
-
George Udosen over 7 yearsPlease add a bit more to your answer so others can follow.
-
wobbily_col almost 7 yearsWorked for me in a Vagrant box increasing the memory size.