On Tue, Oct 02, 2007 at 02:20:53PM +0100, David Reynolds wrote:
On 2 Oct 2007, at 2:12 pm, Chris G wrote:
I need to find a database! :-)
On my Slackware installation I had (well, still have if I start it) a database called 'addresses'. I want to copy it across to the Fedora installation so that mysql on Fedora can see the database. However I can't find the database.
I've tried 'locate addresses' but nothing there looks remotely like a database file (or files).
I suspect that mysql buries all of its databases in one big file somewhere but what's it called?
On debian in /var/lib/mysql is a folder for each database, which then has a bunch of files in it that relate to the database.
However, I wouldn't suggest copying the databases this way, better to dump them from the old install and then import them on the new:
$ mysqldump -u dbuser -p dbname > dbname-$(date +"%Y%d%m").sql
$ mysql -u dbuser -p dbname < dbname-$(date +"%Y%d%m").sql
(Creating the database first, obviously)
Ah, thank you, *that's* where they are. I didn't find them using locate because I wasn't running locate as root.
I've copied the whole old /var/lib/mysql directory over the top of the new one (having shut down mysqld first) and that seems to have worked pretty well, all the databases are now available on my new system.
Thanks again!