LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   How do I Restore a mysql database ? (http://www.linuxquestions.org/questions/linux-software-2/how-do-i-restore-a-mysql-database-823032/)

Glenn D. 07-30-2010 08:59 AM

How do I Restore a mysql database ?
 
Hello
How do I restore a mysql database I need the syntax please.
Thanks Glenn

The backup was done via crontab line.
> /usr/bin/mysqldump -uuserid -ppassword cacti > /backups/cacti-data-backup.sql

> first few lines of dumpfile
head cacti-metadata-backup.sql
-- MySQL dump 10.13 Distrib 5.1.46, for suse-linux-gnu (x86_64)
--
-- Host: localhost Database: cacti
-- ------------------------------------------------------
-- Server version 5.1.46-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

sem007 07-30-2010 09:12 AM

use below command to restore mysql backup

Code:

/usr/bin/mysqldump -uuserid -ppassword -h localhost cacti < /backups/cacti-data-backup.sql
OR
mysql -u user -p DATABASENAME < /path/to/backup.sql



All times are GMT -5. The time now is 01:44 PM.