Migrating a MySQL database?

I am trying to clone a linode vm image from a linode540 to a linode360 (running openSUSE 10.3). However, I need to resize the larger linode image before cloning, and I want to make sure everything is backed up before I try resizing. However, I don’t know how to back up my mysql database. I don’t want to risk losing my db data if the resize is not successful. Are there certain files that I should move?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If nothing else, mysqldump

Also backup /var/lib/mysql (or wherever else your DB files are stored).

Good luck.

zak89 wrote:
> I am trying to clone a linode vm image from a linode540 to a linode360
> (running openSUSE 10.3). However, I need to resize the larger linode
> image before cloning, and I want to make sure everything is backed up
> before I try resizing. However, I don’t know how to back up my mysql
> database. I don’t want to risk losing my db data if the resize is not
> successful. Are there certain files that I should move?
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJdNbw3s42bA80+9kRAjpcAJ45MOQYsIvk6gqhayuzr+/mH5bgBwCfVrOj
sqreteiMoKxg27Lr3IVRRXg=
=UB6j
-----END PGP SIGNATURE-----

Also backup /var/lib/mysql (or wherever else your DB files are stored).

I think that’s what I am trying to figure out. Where are the DB files stored by default? This is just a default openSUSE mysql installation.

You should find a directory with the same name of your database under
/var/lib/mysql
with the relevant files.
This is on my standard opensuse 11.0

This is the command if you have logging turned on; remove -F and the references to master data and logs if you don’t (but not -A):

mysqldump -u root -p -F --master-data=2 -A --delete-master-logs > Filename.sql

This creates an entire script in Filename.sql which you get mysql to run to restore everything,

I know some people have a love/hate relationship with webmin (people either love it or hate it) but I use it for a point and shoot mysql backup.

With webmin installed point a browser to https://127.0.0.1:10000 then navigate to the mysql server configuration. You’ll be shown a list of your databases click on the one you’d like to back up and click the button marked ‘backup database’. Enter (or browse to) a directory path that you’ve got write access to and give it a filename; you can select specific tables to back up or take the whole thing, there’s also option for compression formats if you’d like, and even a way to set it up to back up on a schedule. Then, down at the bottom there’s a button for ‘Save and Backup Now’. Clicking that will generate a file containing the data in that database which can be used to restore to the new location.

I know it’s essentially doing the same thing as the mysqldump referenced above but for those graphically inclined…

I would give a try to “webmin”.:slight_smile:
I pointed to 127.0.0.1.10000 with no success probably it is not installed on my system.
Which packages have I to install? And information for documentation?

Not sure if it’s in the standard repos but it’s available from Webmin

Another beautiful front end is PhpMyAdmin. It’s included with most distros. I installed it last night under Opensuse 10.3 on my machine at home.

In 11.0 there is also

MySQL Administrator version 1.2.12

that can manage the backup/restore task.