If you have a configured mysql dumps to be prepared regularly via cronjob
and you happen to experience crash or lost of data and need to restore only a certain
database from a whole bunch of MySQL data SCRIPT file letes say mysql-fulldump.sql, you might be wondering how.
Here is how:
# sed -n '/^-- Current Database: `DATABASE_NAME`/,/^-- Current Database: `/p' mysql-fulldump.sql > DATABASE_NAME.sql
Change DATABASE_NAME with whatever your required database name is.
mysql-fulldump.sql – is the name of whole database file dump file
DATABASE_NAME.sql – will contain the extracted database from complete SQL dump.
TThat's all, now import new dump to MySQL and Enjoy 🙂
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Hey long time now see, thanks for dropping back again! 🙂
More helpful Articles
- Make MySQL existing users to have access from any or particular host after SQL migration
- Allowing MySQL users access from all hosts – Fixing mysql ERROR 1045 (28000): Access denied for user ‘root’@’remote-admin.com’ (using password: YES)
- List and get rid of obsolete program core dump files and completely disable core files on FreeBSD
- How to auto restart CentOS Linux server with software watchdog (softdog) to reduce server downtime
- How to enable AUTO fsck (ext3, ext4, reiserfs, LVM filesystems) checking on Linux boot through /etc/fstab
- How to check and repair broken MySQL ISAM tables
- Reboot Safely a frozen (hanged up) Linux Server with Magic SysRQ Key combination
- How to list and exclude table names from a database in MySQL (exclude table names from an show tables in MySQL) by using information_schema
- Installing the phpbb forum on Debian (Squeeze/Sid) Linux
- How to dump table from a selected database in MySQL
- How to automatically reboot (restart) Debian GNU Lenny / Squeeze Linux on kernel panic, some general CPU overload or system crash
- Optimize, check and repair tables in MySQL, howto improve work with tables in MySQL
- Few MySQL helpful commands in MySQL maintenance (MySQL rename Table, Empty MySQL Table Contents / Null Table records, Get info about variables in a Table, Change record in existing MySQL table, Get MySQL table privileges info, Some basic commands for MySQL issues debugging)
- Top Paying Google Adsense Keywords for 2013 – Increase blog earnings with high paying keywords
Download PDF Tags: crash, database name, mysql database, script file
This entry was posted on Tuesday, February 12th, 2013 at 11:41 pm and is filed under MySQL, System Administration, Web and CMS. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.