Formatting code for MySqlBackup
===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}}
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}}