Archive for the 'mysql' Category

PHP Database Class to access Mysql

This is a simple class that evolved out of the php code I wrote so far.
It has the following functions :
1. dbms() – The constructor to do the initialisation like connecting to the database etc.
2. query($query) – The method to take a sql string and perform the query.
3. close() – Close the database connection
4. backup() [...]

Restore Mysql Database from a sql or zip file using PHP

In the previous post we saw how the backup of a database can be taken in the form of a sql file and then zipped.

Backup mysql database with php and zip it

PHP can be used to backup a mysql database and make a zip file of it.
mysqldump is the utility which can be used to perform this function of backing up a mysql database as sql file. The command would be like this :
mysqldump –user={$username} –password={$password} –quick –add-drop-table –add-locks –extended-insert –lock-tables –all {$db} > backups/backup.sql