1

background: i installed mysql server on my ubuntu 14.04 aws ec2 server a few nights ago, configured it following guides from reputable sites, and populated it w/ ~80 million rows.

a few times, I received an error when trying to restart mysql:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

After a bit of googling/weeping, i was able to restart it w/ these steps:

sudo service mysql stop
sudo rm /var/lib/mysql/ib_logfile0
sudo rm /var/lib/mysql/ib_logfile1
sudo service mysql stop

then, after it was working fine, I moved the data directory to a newly mounted drive, changed appropriate things in my.cnf and my apparmor config, adjusted permissions and, to my surprise, fired mysql right-up.

unfortunately, creating an index threw a disk space error, and i decided to try re-assigning the temp directory to a bigger drive.

after adjusting apparmor and my.cnf settings, the service again failed to start up, as it had days ago. after undoing the changes i'd made, it started again. then, I simply mounted a new drive to the /tmp directory to deal with the storage concerns.

unfortunately, a strong gust must have hit the server farm, b/c mysql died again. this time, nothing i'd done before worked at all. so, i backed up my data, and prepared to re-install mysql.

wow. what a comically difficult process for an ostensibly simple task. after numerous attempts of uninstalling & reinstalling, I finally found a process that seemed to work:

sudo dpkg --purge mysql-client-core-5.5 # or alternative version
sudo dpkg --purge mysql-client
sudo dpkg --purge mysql-server-core-5.5 # or alternative version
sudo dpkg --purge mysql-common
sudo apt-get --purge remove mysql-server
sudo apt-get --purge remove mysql-client
sudo apt-get --purge remove mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /etc/mysql
sudo rm -rf /var/lib/mysql/
sudo dpkg --configure -a
sudo apt-get update

Great. at that point, which mysql and mysql --version both indicated no mysql.

So, I tried to install again, and again got the same problems as before: when trying to set the root password, it threw an error and said a root password had probably already been set. here's the relevant portion of the install spam:

Setting up mysql-server-5.5 (5.5.47-0ubuntu0.14.04.1) ...
160316  1:13:28 [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.
160316  1:13:28 [Note] /usr/sbin/mysqld (mysqld 5.5.47-0ubuntu0.14.04.1) starting as process 31954 ...
160316  1:13:28 [Warning] Can't create test file /var/lib/mysql/ip-172-31-36-106.lower-test
160316  1:13:28 [Warning] Can't create test file /var/lib/mysql/ip-172-31-36-106.lower-test
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.5; however:
  Package mysql-server-5.5 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
[1]+  Exit 127                /usr/sbin/mysqld

Anyway, now I'm trying to make a Dockerized version work, but that feels like a layer of complexity I don't want.

These symptoms are all over support forums for MySQL, and almost every post has a different accepted answer. So my question is, of course, how do I fix this? But deeper than that, what the heck is going on?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.