A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearIs it possible using PHP to backup SQL without dependecies? If not, which is the best? - page 1
User InfoPosts
Is it possible using PHP to backup SQL without dependecies? If not, which is the best?#1
After a huge MySQL blunder on a production server (my fault, and yes I have learned), I am now looking at creating a dump of the MySQL database before I do a critical operation (about 15 queries to the db, insert/update/selects). I know phpMyAdmin can (dump( the database to SQL queries, but I think this may be a feature of it, not a feature of MySQL?

So, is there a way to do this using MySQL, and if not (which I suspect), what would be the best way to dump the db to a file on the server on command? Preferably as a tarball of the whole DB in ready to import SQL format.

Thank You!

posted date: 2009-04-14 15:15:00


Re: Is it possible using PHP to backup SQL without dependecies? If not, which is the best?#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-14 15:15:01


Re: Is it possible using PHP to backup SQL without dependecies? If not, which is the best?#3
You are looking for the mysqldump function, I believe:mysqldump my_database > database.dump

posted date: 2009-04-14 15:17:00


Re: Is it possible using PHP to backup SQL without dependecies? If not, which is the best?#4
Duplicate: www.momige.com/136269/…

posted date: 2009-04-14 15:22:00


Re: Is it possible using PHP to backup SQL without dependecies? If not, which is the best?#5
MySQL dump will do it, and you can pipe it to gzip so it stores better:mysqldump --opt -Q -h[server] -u[username] -p[password] [dbname] | gzip > [file].sql.gzAnd to restore you unzip it and:mysql -h[server] -u[username] -p[password] [dbname] < [file].sql

posted date: 2009-04-14 15:25:00


Re: Is it possible using PHP to backup SQL without dependecies? If not, which is the best?#6
I(ve used this for a few years now, why re-create the wheel :)http://worldcommunity.com/opensource

posted date: 2009-04-14 15:45:00


Re: Is it possible using PHP to backup SQL without dependecies? If not, which is the best?#7
Another good route is to use something like sqlyog to automate backups. I run this on a local Windows machine I have to do backups of all my remote servers.

posted date: 2009-04-14 15:47:00


Re: Is it possible using PHP to backup SQL without dependecies? If not, which is the best?#8
Whoops, thanks Bill :)

posted date: 2009-04-14 15:48:00


Re: Is it possible using PHP to backup SQL without dependecies? If not, which is the best?#9
If the one line solution works, I'd hardly call that reinventing the wheel.

posted date: 2009-04-14 15:58:00


Re: Is it possible using PHP to backup SQL without dependecies? If not, which is the best?#10
@Till It's not really a duplicate.. my question is PHP specific and is dealing with databases of any size, not just larger ones.

posted date: 2009-04-14 17:52:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.