|
Home ⇒ About Me ⇒ Resume ⇒ Knowledge ⇒ Programming ⇒ Mysql ⇒ Mysql
Experience - 2yrsI've worked with mysql for the past two years. I use PhpMyadmin for most of my routine management tasks, but will also use command line on a daily basis to perform tasks that require more robustness than a browser-based interface can offer. Because Mysql is so closely related with PHP in Development I will provide information on how I use Mysql with PHP rather, than keeping this purely Mysql. Along with the demo's below, please use the site search above for an example of my experience with mysql & full text searching. Note - I've removed a number of elements from this page and others for security purposes PHP/Command Line# BACKUP DB
Performs a loops through specified DB's and writes the sql to a backup location.
set_time_limit(0);
# SETUP FOR DB CONNECTION
$db_host = "localhost";
$db_username = "username";
$db_password = "password";
# SAVE DETAILS
$local_dump_path = "path/to/backup/sqls";
$db_to_dump[] = "db_name1";
$db_to_dump[] = "db_name2";
foreach($db_to_dump as $db_name){
$filename = $DB_NAME.".sql";
$dump_cmd = "mysqldump -h$db_host -u$db_username
-p$db_password $db_name > $local_dump_path/$filename";
exec($dump_cmd);
} |