Backing Up MySQL Databases + tables

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
volkan
Forum Commoner
Posts: 60
Joined: Sat Aug 21, 2004 1:12 pm
Location: London, United Kingdom

Backing Up MySQL Databases + tables

Post by volkan »

Hi
is there no way/program to backup MySQL Data? i need to re-format my server, and i need to save this info.

Can you help?
Cheers
Volkan
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

how big is your db. if it isn't to big and have phpMyAdmin installed then you can just use that to back up each individual db.

other wise look to the command line and use[mysql_man]mysqldump.html[/mysql_man] to back up your date.
I did a search on mysql.com for backing up database and there where a couple of other options as well.
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

Hi Volkan, at most hosting contorl panels there is a backup section. You can do a database backup from this section, I think.
User avatar
volkan
Forum Commoner
Posts: 60
Joined: Sat Aug 21, 2004 1:12 pm
Location: London, United Kingdom

Post by volkan »

ooo, i think i found a way.
Is this possible:


going into the msql install root eg c:\server\mysql\

and making a copy on the folder called 'data' as in this i see folders of my databases.
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

but you cannot do it in your host.
User avatar
volkan
Forum Commoner
Posts: 60
Joined: Sat Aug 21, 2004 1:12 pm
Location: London, United Kingdom

Post by volkan »

it is my server!!!
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

oh, then you can :)
User avatar
volkan
Forum Commoner
Posts: 60
Joined: Sat Aug 21, 2004 1:12 pm
Location: London, United Kingdom

Post by volkan »

Cheers!
User avatar
volkan
Forum Commoner
Posts: 60
Joined: Sat Aug 21, 2004 1:12 pm
Location: London, United Kingdom

Post by volkan »

ok thanks that is done, and while i was at it, i installed a new version of phpmyadmin

however in this version, im not sure how to change DBs username + pword
User avatar
WaldoMonster
Forum Contributor
Posts: 225
Joined: Mon Apr 19, 2004 6:19 pm
Contact:

Post by WaldoMonster »

volkan wrote:ooo, i think i found a way.
Is this possible:


going into the msql install root eg c:\server\mysql\

and making a copy on the folder called 'data' as in this i see folders of my databases.
Yes that is possible :)
Don't forget to first stop the MySQL service.

Code: Select all

net stop mysql
Or go to Control panel > Administrative Tools > Services and stop the MySQL service.

I use a batch file to make a backup this way.
It looks something like this:

Code: Select all

net stop mysql
"d:\Console\rar\rar.exe" u -r0 -as D:\Backup\Data_C.rar @D:\Backup\drive_c.txt
"d:\Console\rar\rar.exe" rr5 D:\Backup\Data_C.rar
"d:\Console\rar\rar.exe" u -r0 -as D:\Backup\Data_D.rar @D:\Backup\drive_d.txt
"d:\Console\rar\rar.exe" rr5 D:\Backup\Data_D.rar
net start mysql
User avatar
volkan
Forum Commoner
Posts: 60
Joined: Sat Aug 21, 2004 1:12 pm
Location: London, United Kingdom

Post by volkan »

ok thanks but how do i add a username + pword for the DB
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Wow, I was just about to post a welcome back reply until I looked more closely and realized your name was "volkan" and not "volka". :(

Oh well, I guess i'll have to wait for the welcome back reply. ;)
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

in phpmyadmin there should be a file config.inc.php you change the configuration from there.
DepecheM
Forum Newbie
Posts: 2
Joined: Sat Oct 16, 2004 6:31 pm

backup mySQL

Post by DepecheM »

You can use the Mysql Administrator program that has an automatic and schedule backup project :P so you can backup your database whenever you want!

for the easy way you can copy from the /mysql/data/youtdatabase all the files!

:mrgreen:
ibizconsultants
Forum Commoner
Posts: 35
Joined: Tue Sep 07, 2004 12:07 pm

Post by ibizconsultants »

Hi Volkan,

You can use the following command on your prompt to backup the entire database along with tables:

mysqldump -u username -p dbname -h hostname > backup.sql

Note: use the "-u hostname" if you do not connect to mysql using localhost.

to restore it back to the server you need to first create the database and assign the necessary rights and the use the following on your prompt

mysql -u username -p dbname -h hostname < backup.sql

Note: again use the "-u hostname" if you do not connect to mysql using localhost.

Hope this helps

Thanks
iBizConsultants
http://www.ibizconsultants.com
Post Reply