Categories
digital ocean Linux MySQL Ubuntu 🏴‍☠️

เมื่อ Mysql Restart ไม่ได้ บน Digital Ocean

Swap Memory

The tiny droplet I have has 512MB RAM, and 20GB on SSD harddisk.
It’s a waste not to create swap memory out of the 20GB SSD!
So, add a few GB of swap memory to your Ubuntu.

Steps:

# Confirm you have no swap
sudo swapon -s

# Allocate 1GB (or more if you wish) in /swapfile
sudo fallocate -l 1G /swapfile

# Make it secure
sudo chmod 600 /swapfile
ls -lh /swapfile

# Activate it
sudo mkswap /swapfile
sudo swapon /swapfile

# Confirm again there’s indeed more memory now
free -m
sudo swapon -s

# Configure fstab to use swap when instance restart
sudo nano /etc/fstab

# Add this line to /etc/fstab, save and exit
/swapfile none swap sw 0 0

# Change swappiness to 10, so that swap is used only when 10% RAM is unused
# The default is too high at 60
echo 10 | sudo tee /proc/sys/vm/swappiness
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf

credit
http://samwize.com/2014/06/10/cannot-restart-mysql-for-digital-ocean-server-low-memory/

https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04

Categories
MySQL 🏴‍☠️

MySql: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111)

Tried several ways and finally solved it through the following way

sudo gksu gedit /etc/mysql/my.cnf
modified

#bind-address = 127.0.0.1

to

bind-address = localhost

or
if your MySQL server IP is 65.55.55.2 then entire block should be look like as follows:
bind-address = 65.55.55.2

and restarted

sudo /etc/init.d/mysql restart
it worked

Rev :
http://stackoverflow.com/questions/5376427/cant-connect-to-local-mysql-server-through-socket-var-mysql-mysql-sock-38
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html