Formatting code for MySqlBackup


show source only

===MySql Database Backup & Restore===
The MySql data files are located in
%%
/var/lib/mysql
%%
but instead of just trying to copy these directly you should use the MySql utilities to backup and restore your database

==Quick Backup==
%%(bash)
#
cat dblist | while read -r db
do
echo $db
mysqldump --add-drop-table --allow-keywords --quote-names $db > $db.sql
done
%%

==Quick Restore==
%%(bash)
#
cat dblist | while read -r db
do
echo $db
mysql -e "DROP DATABASE IF EXISTS \`$db\`"
mysql -e "CREATE DATABASE IF NOT EXISTS \`$db\`"
mysql $db < $db.sql
done
%%

See also
MySqlDump and MySqlRestore

----
REFERRERS
{{backlinks}}
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki