· 6 years ago · Jun 16, 2019, 04:10 AM
1Welcome to the MySQL monitor. Commands end with ; or g.
2Your MySQL connection id is 5
3Server version: 5.6.14 MySQL Community Server (GPL)
4
5Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
6
7Oracle is a registered trademark of Oracle Corporation and/or its
8affiliates. Other names may be trademarks of their respective
9owners.
10
11Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
12
13mysql> use test
14Database changed
15mysql> show create table rangedataG
16*************************** 1. row ***************************
17 Table: rangedata
18Create Table: CREATE TABLE `rangedata` (
19 `id` int(11) NOT NULL AUTO_INCREMENT,
20 `open` float DEFAULT NULL,
21 PRIMARY KEY (`id`)
22) ENGINE=MyISAM AUTO_INCREMENT=34 DEFAULT CHARSET=latin1
231 row in set (0.00 sec)
24
25mysql> select * from rangedata;
26+----+---------+
27| id | open |
28+----+---------+
29| 1 | 1.30077 |
30| 2 | 1.30088 |
31| 3 | 1.30115 |
32| 4 | 1.30132 |
33| 5 | 1.30135 |
34| 6 | 1.30144 |
35| 7 | 1.30132 |
36+----+---------+
377 rows in set (0.00 sec)
38
39mysql>
40
41C:>echo @echo off > C:MyDumpScript.bat
42
43C:>mysql -Dtest -ANe"select date_format(NOW(),'mysqldump test rangedata > MySQLBackup_%Y%m%d_%H%I%S.sql')" >> C:MyDu
44mpScript.bat
45
46C:>type C:MyDumpScript.bat
47@echo off
48mysqldump test rangedata > MySQLBackup_20140314_150353.sql
49
50C:>
51
52C:>C:MyDumpScript.bat
53
54C:>type MySQLBackup_20140314_150353.sql
55-- MySQL dump 10.13 Distrib 5.6.14, for Win64 (x86_64)
56--
57-- Host: localhost Database: test
58-- ------------------------------------------------------
59-- Server version 5.6.14
60
61/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
62/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
63/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
64/*!40101 SET NAMES utf8 */;
65/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
66/*!40103 SET TIME_ZONE='+00:00' */;
67/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
68/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
69/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
70/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
71
72--
73-- Table structure for table `rangedata`
74--
75
76DROP TABLE IF EXISTS `rangedata`;
77/*!40101 SET @saved_cs_client = @@character_set_client */;
78/*!40101 SET character_set_client = utf8 */;
79CREATE TABLE `rangedata` (
80 `id` int(11) NOT NULL AUTO_INCREMENT,
81 `open` float DEFAULT NULL,
82 PRIMARY KEY (`id`)
83) ENGINE=MyISAM AUTO_INCREMENT=34 DEFAULT CHARSET=latin1;
84/*!40101 SET character_set_client = @saved_cs_client */;
85
86--
87-- Dumping data for table `rangedata`
88--
89
90LOCK TABLES `rangedata` WRITE;
91/*!40000 ALTER TABLE `rangedata` DISABLE KEYS */;
92INSERT INTO `rangedata` VALUES (1,1.30077),(2,1.30088),(3,1.30115),(4,1.30132),(5,1.30135),(6,1.30144),(7,1.30132);
93/*!40000 ALTER TABLE `rangedata` ENABLE KEYS */;
94UNLOCK TABLES;
95/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
96
97/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
98/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
99/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
100/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
101/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
102/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
103/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
104
105-- Dump completed on 2014-03-14 15:05:57
106
107C:>
108
109[mysqldump]
110user = root
111password = password
112
113#!/bin/bash
114 #Script backup mysql individual
115 USER="root"
116 DIR="`date | awk {'print $2"_"$3"_"$6'}`"
117 PWDDIR="/mysql/backup_mysql/_mysqldump/"
118 FINALDIR="$PWDDIR$DIR"
119 GZIP_ENABLED=1
120 GZIP="/bin/gzip"
121 MYSQLDUMP="/usr/bin/mysqldump"
122 MYSQL="/usr/bin/mysql"
123 mkdir $FINALDIR
124 databases=`$MYSQL --user=$USER -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema)"`
125
126 for db in $databases; do
127 echo $db
128 if [ $GZIP_ENABLED == 1 ]; then
129 mysqldump --force --opt --user=$USER --databases $db | gzip > "$FINALDIR/$db.gz"
130 else
131 mysqldump --force --opt --user=$USER --databases $db > "$FINALDIR/$db.sql"
132 fi
133 done