-3

One Ubuntu EC2 VPS is fried after an upgrade that went awry.

I don't have the server live, but I have its disk mounted on another (Ubuntu EC2) VPS.

How can I migrate the contents of a database on the mounted filesystem so that I can load it on another machine?

I've used tar and sftp to move stuff in files and directories I've made. I don't know what files would need to be copied to migrate MySQL, and I've gotten the impression that migrating a database appropriately means using database facilities to dump from one machine, then transferring the file to another machine, and then using database facilities to install on another machine: not simply cp.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
Christos Hayward
  • 1,152
  • 3
  • 15
  • 35
  • For starters you should take a look at the documentation in particular for datadir. – user9517 Apr 21 '14 at 16:24
  • 1
    Can't post as an answer necause the question was closed, but it looks like you've got a situation similar to this: http://askubuntu.com/questions/137424/moving-mysql-datadir. That like might help you get to where you want to be. – John Apr 21 '14 at 17:09

2 Answers2

0

It's generally safe to copy the files, so long as MySQL is not running. This doesn't mean that you won't have to repair them later, especially if MySQL had previously crashed.

You'll find them in the specified datadir in MySQL's config; the default is usually /var/lib/mysql.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
0

In addition to copying the datadir directory (by default /var/lib/mysql/) make sure your mysql configuration file (usually /etc/my.cnf or /etc/mysql/my.cnf) has the same innodb options as the old server. You can even copy the entire /etc/my.cnf file over if you don't feel like reading through the file.

If you're innodb settings differ between machines, horrible things will happen to your innodb tables, and mysql.

Some Linux Nerd
  • 3,157
  • 3
  • 18
  • 20