Jump to content

Using PHP to take a backup of a MySQL DB


harishkumar09

Recommended Posts

I have a phpBB forum running on H-SPHERE Control Panel. For some reason I am unable to take take the backup of the forum and my hosting provider is not being of much help either. So I was just wondering if I could just take a backup of my forum by reading all the information from the Database Tables by executing SQL queries from PHP ?

 

Is it possible ? Can I just read it off and output it to a text file and later use it to restore (duplicate) the DB tables ?

Do you have access to your server via SSH?

 

p.s. - There is no easy way to export the data with PHP's MySQL functions. There might be some script out there that someone wrote, but I don't have one. I use the mysqldump command line tool via an SSH shell:

mysqldump --opt -h <hostname> -u <user> -p <pass> <db_name> > <backup_filename>.sql";

 

I then wrap the above command in a PHP script, which does some error checking and emails me with problems. Then, I execute that PHP script with a cronjob.

 

That was really a very good search unidox. In fact I did try searching before posting here. Can you give me some links that teach you how to make effective searches ?

Perhaps you are using a restricted user for phpmyadmin. Edit the config file and make sure the sql user you enter has permissions for the DB.

 

phpmyadmin has a built in backup function

 

Where do I find the config file and how do I do it ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.