Tuesday, September 29, 2015
.::: How to Backup & Restore database MySQL Cacti Windows & Linux :::.
Study Case : MySQL for CactiNMS
Simple Step
1. capture device before backup
2. backup database mysql for cacti
3. add/delete for testing delete & capture
4. restore database mysql for cacti
5. capture device after restore
Detail Step
1. capture device before backup
2. backup database mysql for cacti
mysqldump -l --add-drop-table <db_name> -u <user> -p > mysql.cacti
Windows
with Success
c:\Program Files\MySQL\MySQL Server 5.6\bin> mysqldump -l --add-drop-table cacti -u root -p > mysql.cacti
Enter password: ****
With Error
c:\Program Files\MySQL\MySQL Server 5.6\bin> mysqldump -l --add-drop-table cacti -u root -p c:\cacti\backup\
cacti_database_backup.sql
Enter password: ****
-- MySQL dump 10.13 Distrib 5.5.27, for Win64 (x86)
--
-- Host: localhost Database: cacti
-- ------------------------------------------------------
-- Server version 5.5.27
/*!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 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0
*/;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
mysqldump: Couldn't find table: "c:\cacti\backup\cacti_database_backup.sql"
C:\cacti\backup>dir
Volume in drive C is Windows
Volume Serial Number is EE91-8BE5
Directory of C:\cacti\backup
01/19/2015 03:17 PM <DIR> .
01/19/2015 03:17 PM <DIR> ..
01/19/2015 03:17 PM 645,748 cacti_database_backup.sql
01/19/2015 03:15 PM 645,748 mysql.cacti
2 File(s) 1,291,496 bytes
2 Dir(s) 2,467,594,240 bytes free
C:\cacti\backup>
Linux
[root@CactiNMS backup_mysql]# mysqldump -l --add-drop-table cacti -u root -p > /var/www/backup_mysql/cacti_database_backup.sql
Enter password:
[root@CactiNMS backup_mysql]# ls
cacti_database_backup.sql
[root@CactiNMS backup_mysql]# ls -lh
total 1.6M
-rw-r--r-- 1 root root 1.6M Jan 22 11:32 cacti_database_backup.sql
[root@CactiNMS backup_mysql]# pwd
/var/www/backup_mysql
[root@CactiNMS backup_mysql]#
3. add/delete for testing delete & capture
4. restore database mysql for cacti
mysql -u [uname] -p[pass] [db_to_restore] < [backupfile.sql]
c:\Program Files\MySQL\MySQL Server 5.6\bin> mysql -u cactiuser -p cacti < mysql.cacti
Enter password: *******
c:\Program Files\MySQL\MySQL Server 5.6\bin>
5. capture device after restore
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Sertifikasi profesional, kadang hanya disebut dengan sertifikasi atau kualifikasi saja, adalah suatu penetapan yang diberikan oleh ...
-
SQL atau Structured Query Language) adalah sebuah bahasa yang digunakan untuk mengakses data dalam basis data relasional. Bahasa ini sec...
-
bagaimana cara mengubah hostid di Solaris The Hostid is a globally unique ID for a Sun Solaris Machine. Sometimes, you need to change t...
-
DNSPerf and ResPerf are free tools developed by Nominum that make it simple to gather accurate latency and throughput metrics for Domain ...
-
1. Check Host ID Solaris The Hostid is a globally unique ID for a Sun Solaris Machine. Sometimes, you need to change this hostid for ...
No comments:
Post a Comment