Updated: Fri Mar 12, 2010 (12:00), A PHP / MySQL professional (10 yrs.exp.) is seeking employment outside Ukraine, CV and contact pages available at this site.

Welcome!

Contains materials for dummies This blog is for Linux dummies as just I am.

This blog contains various solutions and how-toes on the current release of Fedora Linux distribution and several Linux articles and tutorials.

View a PHP / MySQL / AJAX / JAVASCRIPT Freelancer Programmer profile on LinkedIn Follow me on twitter

Fedora Availability

Historically Test and General Availability releases happen at 10:00am Eastern US Time...

Announcement

A php/mysql freelancer programmer since 2001 is looking for contract work. Please use contact form at this page.

The full resume with examples of PHP/MySQL/Javascript projects, working experience and recommendations is available online from this page.

Get ioncube encoder

Ioncube encoder is the best solution for php developers

Ioncube encoder is the best solution for a php developer

Path: Blog > Linux > How-Toes > Preparing for Fedora 11 – MySQL Database-per-file Dump

Preparing for Fedora 11 – MySQL Database-per-file Dump

Yes, yes, man, I am still NOT on Fedora 11… Because I know how newly-out distributions of Fedora tend to behave on my hardware (which is never really brand-pathetic but effective in the terms of gigahertzes  and terabytes). I have to wait a month or two before I really make a decision to slowly migrate the oldest of my laptops to 11 as soon as I see that Livna and other repos are really ripe ready for that…

The below is a pretty short solution for backup up your MySQL databases in case you really need it.

Moreover, it’s a pretty good stimulus to clean everything up and kinda start from the scratch. Itchy jobless freelancers would probably know what I mean during the world economical crisis as it was said on the TV…

So, create a ~/bin dir is it still does not exist and a script file to be used for MySQL dumping.

mkdir -p ~/bin
touch ~/bin/mysqlfiledump.sh
chmod +x ~/bin/mysqlfiledump.sh
gedit ~/bin/mysqlfiledump.sh

It will open a window with an empty file to edit. Copy and paste the below.

#!/bin/bash
# backup each mysql db into a different file, rather than one big file
# as with --all-databases - will make restores easier
USER="MYSQL_USER_NAME"
PASSWORD="MYSQL_PASSWORD"
OUTPUTDIR="./"
MYSQLDUMP="mysqldump"
MYSQL="mysql"
databases=`$MYSQL --user=$USER --password=$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
for db in $databases; do
echo $db
$MYSQLDUMP --force --opt --routines --user=$USER --password=$PASSWORD --databases $db > "$OUTPUTDIR/$db.dump.sql"
done

Make needed replacements, save and run in the terminal in just any directory – this will create a pack of *.dump.sql files with the desired dumps.

mysqlfiledump.sh

For the security purposes, I would delete the script file thereafter or simply clear the MySQL user and password data. And bookmark this site for future reference, of course.

Support this site:        

Leave a comment

You must be logged in to post a comment.

Get a Free Web Project Quote from a PHP Freelancer Consultant


 
 
 
 

Fight Spam!   Add to Technorati Favorites Programming Blogs - BlogCatalog Blog Directory       Programming Blog Directory
Software   Top Blogs

blogarama - the blog directory