Posted by accidental-admin on September 14, 2010 at 5:15pm
Running 1.1 Beta using the Amazon AMI. Got the instance running nicely. Then, following the instructions posted here:
http://groups.drupal.org/node/33092
for moving mysql and webroot to EBS. Doing so creates an error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
I've tried MANY things, mysql restart, stop, start, etc. Creating a new mysqld.sock. Nothing works.
Trying to restart mysql results in the following:
ubuntu@ip-10-xx-xx-8:/var/run$ sudo /etc/init.d/mysql restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql restart
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the restart(8) utility, e.g. restart mysql
<<terminal hangs here for a while>>>
mysql start/post-start, (post-start) process 3476Anybody able to get this going on the 64 Bit 1.1 AMI?
Any help is greatly appreciated
Comments
Right, had exactly this
Right, had exactly this happen to me last week. In my case, it was a corrupted EBS snapshot, probably because mysql was in the middle of a process when it was taken. Trying a new, clean snapshot solved the problem. Just terminate your current new instance and start a fresh new one -- trying to save that instance will likely prolong your headache unnecessarily.
I modified Doug's script a bit to the following (assumes you have a new instance spun up, Mercury has completed its set up routine, and you've attached the volume already):
#!/bin/bash
# volume must be attached via EC2 tools before running through this
# example: ec2-attach-volume -d /dev/sdh -i INSTANCE-ID VOLUME-ID
# where INSTANCE-ID and VOLUME-ID are replaced with your instance and volume ids.
sudo -E apt-get install -y xfsprogs
sudo service mysql stop
echo "/dev/sdh /vol xfs noatime 0 0" | sudo tee -a /etc/fstab
sudo mkdir -m 000 /vol
sudo mount /vol
sudo rm -R /mnt/mysql
sudo rm -R /var/lib/mysql
sudo rm -R /var/log/mysql
sudo mkdir /mnt/mysql
sudo mkdir /var/lib/mysql
sudo mkdir /var/log/mysql
sudo find /vol/{lib,log}/mysql/ ! -user root -print0 |
sudo xargs -0 -r chown mysql
sudo find /vol/{lib,log}/mysql/ ! -group root -a ! -group adm -print0 |
sudo xargs -0 -r chgrp mysql
echo "/vol/etc/mysql /mnt/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /mnt/mysql
echo "/vol/lib/mysql /var/lib/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /var/lib/mysql
echo "/vol/log/mysql /var/log/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /var/log/mysql
# attach to the EBS doc root for apache
# remove instance doc root (not needed)
sudo rm -R /var/www
# make the new doc root for apache
sudo ln -s /vol/var/www /var/www
# restart apache so new doc root is used
sudo /etc/init.d/apache2 restart
# sudo /etc/init.d/mysql start
sudo service mysql start
Hope this helps!