Re: MySQL backups?

From: Date: Fri, 05 Jul 2002 03:21:54 +0000
Subject: Re: MySQL backups?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-105562@lists.php.net to get a copy of this message
Pag wrote:
    Like you all probably know from a previous post, i am designing a website using MySQL, well, redesigning anyway. So i do all the database'ing stuff, fill the tables with news, content, etc, what if i eventually have to change hosts? How can i move my data from one side to another? Or even make a backup on my computer at home. I dont think we loose all information when we have to move, right? 
So long as you have shell access, you can use mysqldump. The syntax is exactly the same as mysql, so the command might look something like this: mysqldump -uyouruser -pyourpasswd yourdatabase The SQL required to build all of your tables and insert all of the data will be output to the screen. So, you might want to redirect it to a file: mysqldump -uyouruser -pyourpasswd yourdatabase > yourbackupfile.sql There are, of course, many different options for mysqldump, so you can separate the schema from the data, for example. Your schema may rarely (or never) change, so maybe you just want to backup the data only. This is the method I personally use; I have an elaborate expect script that names my backups according to the date, tars them by month and by year, and FTPs them to multiple servers as a primitive form of a redundant backup. Happy hacking. Chris

« previous php.general (#105562) next »