You are not logged in.

#1 2009-07-13 09:12:04

skazhy
Member
From: Riga, Latvia
Registered: 2009-07-01
Posts: 46

exporting mysql database

Hi!

I have archlinux 2009.02 on a PC and there are some boot problems with it (something simillar like in this thread http://bbs.archlinux.org/viewtopic.php?id=75530), so the easiest way seems to be reinstalling arch. I copied all files from the machine with knoppix 6.0.1, but I need to export my mysql database too. How can I do this (mysql is not installed on knoppix)?

Or maybe I can export it with arch live cd?

Thanks in advance,

-skazhy

Offline

#2 2009-07-13 12:56:37

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: exporting mysql database

I *think* you can just copy the data files from /var/mysql/ if the MySQL process isn't running... Someone else can confirm that I hope.

Offline

#3 2009-07-13 13:09:12

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,694
Website

Re: exporting mysql database

The "correct" way to get your schemas out of a MySQL database is :

mysqldump --user=root --password my_db > my_db.sql

That's is. You then install the new MySQL database somewhre else and you can then upload your schema into it. smile

R.

Last edited by ralvez (2009-07-13 13:09:46)

Offline

#4 2009-07-13 14:59:21

marxav
Member
From: Gatineau, PQ, Canada
Registered: 2006-09-24
Posts: 386

Re: exporting mysql database

I know with postgresql, you can copy the data directory.  But it might create problems if you move it between major version release.  MySQL might be the same.

Offline

#5 2009-07-13 22:45:00

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: exporting mysql database

ralvez wrote:

The "correct" way to get your schemas out of a MySQL database is :

mysqldump --user=root --password my_db > my_db.sql

That's is. You then install the new MySQL database somewhre else and you can then upload your schema into it. smile

R.

Yes, that is assuming the MySQL server is running. The OP is trying to backup from a LiveCD without a copy of the MySQL binaries.

marxav wrote:

I know with postgresql, you can copy the data directory.  But it might create problems if you move it between major version release.  MySQL might be the same.

I'd assume it would be the same, but if you keep the same version, it should be OK. Backup /var/cache/pacman/pkg/mysql* too maybe?

Offline

#6 2009-07-13 23:13:10

BurntSushi
Member
From: Massachusetts
Registered: 2009-06-28
Posts: 362
Website

Re: exporting mysql database

Yes, copying the data directory directly should work. Just make sure the proper permissions are set on the data files, or else you'll be getting some ugly errors when you try updating your database.


Education is favorable to liberty. Freedom can exist only in a society of knowledge. Without learning, men are incapable of knowing their rights, and where learning is confined to a few people, liberty can be neither equal nor universal.

Tu ne cede malis sed contra audentior ito

Offline

Board footer

Powered by FluxBB