Question

Will msql automatically start using the new volume I add to my droplet

Posted June 30, 2019 746 views
MySQLDigitalOceanUbuntu 16.04

I had this error

MySQL -Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock

Turns out it was because I didnt have any more disk space left, so the mysql service refused to restart.
Suppose I add a volume to DigitalOcean Droplet, do I need to confgure anything for mysql to use that diskspace ?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

Hello,

It really depends on how you’ve done your partitioning. You could run this command here to make sure that the extra space is now availalbe:

df -h

Also if the extra space is availalbe you could just start your MySQL service with this command:

systemctl start mysql

Hope that this helps!
Bobby

@ufoundashish

Attaching a Volume to your Droplet will not automatically increase the disk space available on the local SSD. Currently, the only way to increase local storage would be to resize your Droplet.

When it comes to Volumes, they function much like an external disk plugged into your PC or Mac would–they will provide additional storage, though on a separate mount point than the local disk.

Since MySQL is installed on the local disk by default, you would need to migrate the data directory to the volume (ensuring permissions are maintained). You would then need to update the data directory that MySQL uses to ensure that, once restarted, it pulls information from the volume.

-

We have a guide that covers changing the data directory and moving the MySQL data over to a volume here.

Note: I would highly recommend taking a Snapshot of your Droplet before proceeding to ensure that you have a working backup in case something goes wrong.

by Melissa Anderson
Whether you’re adding more space for data or evaluating ways to optimize database performance, this tutorial will guide you through relocating MySQL’s data directory.
Submit an Answer