Hello -
Short story is my admin is no longer with us and I’m not that familiar with this setup, so appreciate any help.
We have an Ubuntu droplet for our MySql database: db-droplet We have a volume attached to that droplet and our db tables and data live there: /mnt/db-volume-01
I see in our droplet it has a symbolic link to what I assume is the original location where the db was storing the db table data.
/mysql/db_tables -> /var/lib/mysql/db_tables
We no longer need the volume so we’d like to copy back our data from the volume to the droplet, remove the symbolic link and then detach & delete the volume.
Can anyone please provide the necessary steps and commands to do the above? Much appreciated!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Greetings!
I can kind of get you there a bit, but some pieces are relative and you’ll need to consider how they impact you because they might be just a little wrong. Where I’m failing the most, which may cause me to be wrong, is drawing correlation between /mnt/db-volume-01 and /mysql. If the additional volume is mounted at /mnt/db-volume-01 and the databases are symlinked from /mysql, then I assume the databases are not on the additional volume. So for my purposes here, I’m going to just make an assumption that the databases are at /mnt/db-volume-01/mysql and work accordingly.
Under my assumption, this is what I’d do:
service mysql stop && systemctl stop mysql #Covers init and systemd, if one fails no issue.
unlink /var/lib/mysql
cp -R /mnt/db-volume-01/mysql /var/lib
service mysql start && systemctl start mysql
umount /mnt/db-volume-01
This is mildly dangerous and may fail, restoring droplet backup should undo the failure.
Jarland
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.