You are not logged in.
My Arch Linux server recently broke and I need to perform a fresh install on it. However, I failed to ever create a SQL dump of the MariaDB database using the mysqldump command (I know...). I have booted into the server using an Arch Live USB and have copied out all the files I need, but now am wondering how to back up the SQL database. Since I'm planning to go from the same version of Arch and MariaDB to the same version of Arch and MariaDB, if I copy over all the files in /var/lib/mysql, will that do the trick? To clarify, I'd copy the files to an external drive, wipe the system and complete the fresh Arch (and MariaDB) installation on it, and then overwrite the new /var/lib/mysql folder with my backup. Does anyone know if this would work or if there's a better way? Thanks.
Last edited by tony5429 (2018-01-21 13:51:46)
Offline
I can't offer an answer to the question you're actually asking, but I'm wondering why there isn't a different one being asked:
My Arch Linux server recently broke and I need to perform a fresh install on it.
In what way is it "broke" that a fresh install would be a reasonable solution? Just fix it.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
I can't offer an answer to the question you're actually asking, but I'm wondering why there isn't a different one being asked:
tony5429 wrote:My Arch Linux server recently broke and I need to perform a fresh install on it.
In what way is it "broke" that a fresh install would be a reasonable solution? Just fix it.
I should have explained a little better. To clarify, some booting issues arose after a system upgrade a few days ago. I did a bit of searching around the forums but wasn't able to come to a solution, and I think a fresh install may solve the problem so I'd like to try it.
Offline
I'm pretty sure you can in fact drop in /var/lib/mysql after you get the mariadb package installed. Recommend you install the package, remove or rename /var/lib/mysqld (that the package created) then drop in the old one and replicate the permissions and ownership.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
I'm pretty sure you can in fact drop in /var/lib/mysql after you get the mariadb package installed. Recommend you install the package, remove or rename /var/lib/mysqld (that the package created) then drop in the old one and replicate the permissions and ownership.
Thanks for the info and tip. Sounds like a good plan; I hadn't thought about permissions/ownership - that will be good to have the default folder structure renamed so I can compare them side-by-side and adjust things accordingly. OK, I'm going to give it a shot. FIngers crossed!
Offline
Probably should have recommended that you stop the service if it's running, but that seems too obvious
EDIT: Also, don't recursively apply the chown and chmod command... just to /var/lib/mysqld if needed. All of the permissions/ownerships for files under that should not change relative to your old install.
Last edited by graysky (2018-01-20 15:25:27)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Probably should have recommended that you stop the service if it's running, but that seems too obvious
EDIT: Also, don't recursively apply the chown and chmod command... just to /var/lib/mysqld if needed. All of the permissions/ownerships for files under that should not change relative to your old install.
I haven't been able to get the service to start again, otherwise I'd just run mysqldump
I actually haven't wiped the system just yet. I was thinking, to preserve the file permissions / directory structure / etc, could I just make a tarball like this and then decompress it later?
tar cvpzf db.tar.gz /var/lib/mysql
mv /var/lib/mysql /var/lib/mysql_backup
tar xpvzf db.tar.gz
Offline
This plan (using a tarball to backup/restore the db) worked perfectly!
Offline