先不说话  先来一段代码块

  1. mysql> show variables like 'autocommit';
  2. +---------------+-------+
  3. | Variable_name | Value |
  4. +---------------+-------+
  5. | autocommit | ON |
  6. +---------------+-------+
  7. 1 row in set (0.00 sec)
  8.  
  9. mysql> set autocommit=0;
  10. Query OK, 0 rows affected (0.00 sec)
  11.  
  12. mysql> show variables like 'autocommit';
  13. +---------------+-------+
  14. | Variable_name | Value |
  15. +---------------+-------+
  16. | autocommit | OFF |
  17. +---------------+-------+
  18. 1 row in set (0.00 sec)
  19.  
  20. mysql> show master status;
  21. +------------------+----------+--------------+------------------+-------------------+
  22. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  23. +------------------+----------+--------------+------------------+-------------------+
  24. | mysql-bin.000034 | 120 | | | |
  25. +------------------+----------+--------------+------------------+-------------------+
  26. 1 row in set (0.00 sec)
  27.  
  28. #第二个
  29. mysql> create database luna;
  30. Query OK, 1 row affected (0.00 sec)
  31.  
  32. mysql> show master status;
  33. +------------------+----------+--------------+------------------+-------------------+
  34. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  35. +------------------+----------+--------------+------------------+-------------------+
  36. | mysql-bin.000034 | 214 | | | |
  37. +------------------+----------+--------------+------------------+-------------------+
  38. 1 row in set (0.00 sec)
  39.  
  40. mysql> use luna;
  41. Database changed
  42. mysql> create table t1(id int);
  43. Query OK, 0 rows affected (0.08 sec)
  44.  
  45. mysql> show master status;
  46. +------------------+----------+--------------+------------------+-------------------+
  47. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  48. +------------------+----------+--------------+------------------+-------------------+
  49. | mysql-bin.000034 | 311 | | | |
  50. +------------------+----------+--------------+------------------+-------------------+
  51. 1 row in set (0.00 sec)
  52.  
  53. mysql> insert into t1 values(1);
  54. Query OK, 1 row affected (0.00 sec)
  55.  
  56. mysql> show master status;
  57. +------------------+----------+--------------+------------------+-------------------+
  58. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  59. +------------------+----------+--------------+------------------+-------------------+
  60. | mysql-bin.000034 | 311 | | | |
  61. +------------------+----------+--------------+------------------+-------------------+
  62. 1 row in set (0.00 sec)
  63.  
  64. mysql> commit;
  65. Query OK, 0 rows affected (0.33 sec)
  66.  
  67. mysql> show master status;
  68. +------------------+----------+--------------+------------------+-------------------+
  69. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  70. +------------------+----------+--------------+------------------+-------------------+
  71. | mysql-bin.000034 | 499 | | | |
  72. +------------------+----------+--------------+------------------+-------------------+
  73. 1 row in set (0.00 sec)
  74.  
  75. #update
  76. mysql> update t1 set id=11 where id=1;
  77. Query OK, 1 row affected (0.00 sec)
  78. Rows matched: 1 Changed: 1 Warnings: 0
  79.  
  80. mysql> show master status;
  81. +------------------+----------+--------------+------------------+-------------------+
  82. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  83. +------------------+----------+--------------+------------------+-------------------+
  84. | mysql-bin.000034 | 857 | | | |
  85. +------------------+----------+--------------+------------------+-------------------+
  86. 1 row in set (0.00 sec)
  87.  
  88. mysql> show master status;
  89. +------------------+----------+--------------+------------------+-------------------+
  90. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  91. +------------------+----------+--------------+------------------+-------------------+
  92. | mysql-bin.000034 | 1051 | | | |
  93. +------------------+----------+--------------+------------------+-------------------+
  94. 1 row in set (0.00 sec)
  95.  
  96. #delete
  97. mysql> delete from t1 where id=2;
  98. Query OK, 1 row affected (0.00 sec)
  99.  
  100. mysql> show master status;
  101. +------------------+----------+--------------+------------------+-------------------+
  102. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  103. +------------------+----------+--------------+------------------+-------------------+
  104. | mysql-bin.000034 | 1051 | | | |
  105. +------------------+----------+--------------+------------------+-------------------+
  106. 1 row in set (0.00 sec)
  107.  
  108. mysql> commit;
  109. Query OK, 0 rows affected (0.01 sec)
  110.  
  111. mysql> show master status;
  112. +------------------+----------+--------------+------------------+-------------------+
  113. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  114. +------------------+----------+--------------+------------------+-------------------+
  115. | mysql-bin.000034 | 1239 | | | |
  116. +------------------+----------+--------------+------------------+-------------------+
  117. 1 row in set (0.00 sec)
  118.  
  119. #drop
  120. mysql> select * from t1;
  121. +------+
  122. | id |
  123. +------+
  124. | 11 |
  125. | 3 |
  126. | 4 |
  127. +------+
  128. 3 rows in set (0.00 sec)
  129.  
  130. mysql> update t1 set id=44 where id=4;
  131. Query OK, 1 row affected (0.00 sec)
  132. Rows matched: 1 Changed: 1 Warnings: 0
  133.  
  134. mysql> drop table t1;
  135. Query OK, 0 rows affected (0.04 sec)
  136.  
  137. mysql> drop database luna;
  138. Query OK, 0 rows affected (0.08 sec)
  139.  
  140. mysql> show master status;
  141. +------------------+----------+--------------+------------------+-------------------+
  142. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  143. +------------------+----------+--------------+------------------+-------------------+
  144. | mysql-bin.000034 | 1633 | | | |
  145. +------------------+----------+--------------+------------------+-------------------+
  146. 1 row in set (0.00 sec)
  147.  
  148. #工具查看
  149. mysql> show binlog events in 'mysql-bin.000034';
  150.  
  151. #在命令行查看
  152.  
  153. [root@db01-sa mysql]# mysqlbinlog --base64-output=decode-rows -vvv /data/mysql/mysql-bin.000034
  154.  
  155. /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
  156. /*!40019 SET @@session.max_insert_delayed_threads=0*/;
  157. /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
  158. DELIMITER /*!*/;
  159. # at 4
  160. #180627 17:49:07 server id 6 end_log_pos 120 CRC32 0x75f5723b Start: binlog v 4, server v 5.6.38-log created 180627 17:49:07 at startup
  161. # Warning: this binlog is either in use or was not closed properly.
  162. ROLLBACK/*!*/;
  163. # at 120
  164. #180627 18:21:12 server id 6 end_log_pos 214 CRC32 0x0a1b14fc Query thread_id=2 exec_time=0 error_code=0
  165. SET TIMESTAMP=1530094872/*!*/;
  166. SET @@session.pseudo_thread_id=2/*!*/;
  167. SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
  168. SET @@session.sql_mode=1075838976/*!*/;
  169. SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
  170. /*!\C utf8 *//*!*/;
  171. SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=33/*!*/;
  172. SET @@session.lc_time_names=0/*!*/;
  173. SET @@session.collation_database=DEFAULT/*!*/;
  174. create database luna
  175. /*!*/;
  176. # at 214
  177. #180627 18:22:16 server id 6 end_log_pos 311 CRC32 0x9fe876dc Query thread_id=2 exec_time=0 error_code=0
  178. use `luna`/*!*/;
  179. SET TIMESTAMP=1530094936/*!*/;
  180. create table t1(id int)
  181. /*!*/;
  182. # at 311
  183. #180627 18:23:02 server id 6 end_log_pos 383 CRC32 0xa66c8e7d Query thread_id=2 exec_time=0 error_code=0
  184. SET TIMESTAMP=1530094982/*!*/;
  185. BEGIN
  186. /*!*/;
  187. # at 383
  188. #180627 18:23:02 server id 6 end_log_pos 428 CRC32 0xf0097518 Table_map: `luna`.`t1` mapped to number 70
  189. # at 428
  190. #180627 18:23:02 server id 6 end_log_pos 468 CRC32 0x2b1aa647 Write_rows: table id 70 flags: STMT_END_F
  191. ### INSERT INTO `luna`.`t1`
  192. ### SET
  193. ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
  194. # at 468
  195. #180627 18:23:28 server id 6 end_log_pos 499 CRC32 0x62719421 Xid = 37
  196. COMMIT/*!*/;
  197. # at 499
  198. #180627 18:25:06 server id 6 end_log_pos 571 CRC32 0x84c9efe6 Query thread_id=2 exec_time=0 error_code=0
  199. SET TIMESTAMP=1530095106/*!*/;
  200. BEGIN
  201. /*!*/;
  202. # at 571
  203. #180627 18:25:06 server id 6 end_log_pos 616 CRC32 0x74d151e2 Table_map: `luna`.`t1` mapped to number 70
  204. # at 616
  205. #180627 18:25:06 server id 6 end_log_pos 656 CRC32 0xd10d7120 Write_rows: table id 70 flags: STMT_END_F
  206. ### INSERT INTO `luna`.`t1`
  207. ### SET
  208. ### @1=2 /* INT meta=0 nullable=1 is_null=0 */
  209. # at 656
  210. #180627 18:27:16 server id 6 end_log_pos 701 CRC32 0x7895e39d Table_map: `luna`.`t1` mapped to number 70
  211. # at 701
  212. #180627 18:27:16 server id 6 end_log_pos 741 CRC32 0x5acc32fe Write_rows: table id 70 flags: STMT_END_F
  213. ### INSERT INTO `luna`.`t1`
  214. ### SET
  215. ### @1=3 /* INT meta=0 nullable=1 is_null=0 */
  216. # at 741
  217. #180627 18:27:30 server id 6 end_log_pos 786 CRC32 0xb4ed9f5a Table_map: `luna`.`t1` mapped to number 70
  218. # at 786
  219. #180627 18:27:30 server id 6 end_log_pos 826 CRC32 0x819e8db3 Write_rows: table id 70 flags: STMT_END_F
  220. ### INSERT INTO `luna`.`t1`
  221. ### SET
  222. ### @1=4 /* INT meta=0 nullable=1 is_null=0 */
  223. # at 826
  224. #180627 18:27:58 server id 6 end_log_pos 857 CRC32 0x452e1f31 Xid = 41
  225. COMMIT/*!*/;
  226. # at 857
  227. #180627 18:29:56 server id 6 end_log_pos 929 CRC32 0x5e68dff7 Query thread_id=2 exec_time=0 error_code=0
  228. SET TIMESTAMP=1530095396/*!*/;
  229. BEGIN
  230. /*!*/;
  231. # at 929
  232. #180627 18:29:56 server id 6 end_log_pos 974 CRC32 0xf4e4e2bf Table_map: `luna`.`t1` mapped to number 70
  233. # at 974
  234. #180627 18:29:56 server id 6 end_log_pos 1020 CRC32 0x2d809738 Update_rows: table id 70 flags: STMT_END_F
  235. ### UPDATE `luna`.`t1`
  236. ### WHERE
  237. ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
  238. ### SET
  239. ### @1=11 /* INT meta=0 nullable=1 is_null=0 */
  240. # at 1020
  241. #180627 18:30:25 server id 6 end_log_pos 1051 CRC32 0x08029580 Xid = 52
  242. COMMIT/*!*/;
  243. # at 1051
  244. #180627 18:31:25 server id 6 end_log_pos 1123 CRC32 0xcf1b6980 Query thread_id=2 exec_time=0 error_code=0
  245. SET TIMESTAMP=1530095485/*!*/;
  246. BEGIN
  247. /*!*/;
  248. # at 1123
  249. #180627 18:31:25 server id 6 end_log_pos 1168 CRC32 0x7729069b Table_map: `luna`.`t1` mapped to number 70
  250. # at 1168
  251. #180627 18:31:25 server id 6 end_log_pos 1208 CRC32 0x04cb5496 Delete_rows: table id 70 flags: STMT_END_F
  252. ### DELETE FROM `luna`.`t1`
  253. ### WHERE
  254. ### @1=2 /* INT meta=0 nullable=1 is_null=0 */
  255. # at 1208
  256. #180627 18:31:36 server id 6 end_log_pos 1239 CRC32 0x27093f44 Xid = 56
  257. COMMIT/*!*/;
  258. # at 1239
  259. #180627 18:33:45 server id 6 end_log_pos 1311 CRC32 0x8be80fc2 Query thread_id=2 exec_time=0 error_code=0
  260. SET TIMESTAMP=1530095625/*!*/;
  261. BEGIN
  262. /*!*/;
  263. # at 1311
  264. #180627 18:33:45 server id 6 end_log_pos 1356 CRC32 0x77578bf1 Table_map: `luna`.`t1` mapped to number 70
  265. # at 1356
  266. #180627 18:33:45 server id 6 end_log_pos 1402 CRC32 0x9c7bf8df Update_rows: table id 70 flags: STMT_END_F
  267. ### UPDATE `luna`.`t1`
  268. ### WHERE
  269. ### @1=4 /* INT meta=0 nullable=1 is_null=0 */
  270. ### SET
  271. ### @1=44 /* INT meta=0 nullable=1 is_null=0 */
  272. # at 1402
  273. #180627 18:34:17 server id 6 end_log_pos 1433 CRC32 0x354e0150 Xid = 60
  274. COMMIT/*!*/;
  275. # at 1433
  276. #180627 18:34:17 server id 6 end_log_pos 1548 CRC32 0x52b3dc50 Query thread_id=2 exec_time=0 error_code=0
  277. SET TIMESTAMP=1530095657/*!*/;
  278. DROP TABLE `t1` /* generated by server */
  279. /*!*/;
  280. # at 1548
  281. #180627 18:34:26 server id 6 end_log_pos 1633 CRC32 0x2e40af97 Query thread_id=2 exec_time=0 error_code=0
  282. SET TIMESTAMP=1530095666/*!*/;
  283. drop database luna
  284. /*!*/;
  285. DELIMITER ;
  286. # End of log file
  287. ROLLBACK /* added by mysqlbinlog */;
  288. /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
  289. /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
  290.  
  291. #截取
  292. [root@db01-sa mysql]# mysqlbinlog --start-position=120 --stop-position=857 /data/mysql/mysql-bin.000034 >/tmp/luna2.sql
  293. WARNING: The range of printed events ends with a row event or a table map event that does not have the STMT_END_F flag
  294. set. This might be because the last statement was not fully written to the log, or because you are using a
  295. --stop-position or --stop-datetime that refers to an event in the middle of a statement. The event(s) from
  296. the partial statement have not been written to output.
  297.  
  298. 警告:打印事件的范围以行或表映射事件结束,没有设置了STMT_END_F标志。这可能是因为过去的声明没有完全写入日志,或者因为您使
  299. 用的是——停止位置,stop-datetime指一个事件在一份声明中。部分语句中的事件尚未写入输出。
  300.  
  301. #产生以上报错就是因为截取的时候 一定要注意begin begin是一个语句的开始 一定要从begin之前开始截断
  302. 之前的语句mysqlbinlog --start-position=120 --stop-position=974 /data/mysql/mysql-bin.000034 >/tmp/luna.sql 当中的974要改成857
  303.  
  304. mysql> set sql_log_bin=0;
  305. Query OK, 0 rows affected (0.00 sec)
  306.  
  307. mysql> source /tmp/luna.sql;
  308. Query OK, 0 rows affected (0.00 sec)
  309.  
  310. Query OK, 0 rows affected, 1 warning (0.00 sec)
  311.  
  312. Query OK, 0 rows affected (0.00 sec)
  313.  
  314. Query OK, 0 rows affected (0.00 sec)
  315.  
  316. Query OK, 0 rows affected (0.00 sec)
  317.  
  318. Query OK, 0 rows affected (0.00 sec)
  319.  
  320. Query OK, 0 rows affected (0.00 sec)
  321.  
  322. Query OK, 0 rows affected (0.00 sec)
  323.  
  324. Query OK, 0 rows affected (0.00 sec)
  325.  
  326. Query OK, 0 rows affected (0.00 sec)
  327.  
  328. Charset changed
  329. Query OK, 0 rows affected (0.00 sec)
  330.  
  331. Query OK, 0 rows affected (0.00 sec)
  332.  
  333. Query OK, 0 rows affected (0.00 sec)
  334.  
  335. Query OK, 0 rows affected (0.00 sec)
  336.  
  337. Query OK, 1 row affected (0.00 sec)
  338.  
  339. Database changed
  340. Query OK, 0 rows affected (0.00 sec)
  341.  
  342. Query OK, 0 rows affected (0.36 sec)
  343.  
  344. Query OK, 0 rows affected (0.00 sec)
  345.  
  346. Query OK, 0 rows affected (0.00 sec)
  347.  
  348. Query OK, 0 rows affected (0.01 sec)
  349.  
  350. Query OK, 0 rows affected (0.00 sec)
  351.  
  352. Query OK, 0 rows affected (0.01 sec)
  353.  
  354. Query OK, 0 rows affected (0.00 sec)
  355.  
  356. Query OK, 0 rows affected (0.00 sec)
  357.  
  358. Query OK, 0 rows affected (0.03 sec)
  359.  
  360. Query OK, 0 rows affected (0.00 sec)
  361.  
  362. Query OK, 0 rows affected (0.01 sec)
  363.  
  364. Query OK, 0 rows affected (0.00 sec)
  365.  
  366. Query OK, 0 rows affected (0.00 sec)
  367.  
  368. Query OK, 0 rows affected (0.00 sec)
  369.  
  370. Query OK, 0 rows affected (0.00 sec)
  371.  
  372. Query OK, 0 rows affected (0.00 sec)
  373.  
  374. mysql> show database;
  375. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
  376. mysql> show databases;
  377. +--------------------+
  378. | Database |
  379. +--------------------+
  380. | information_schema |
  381. | binlog |
  382. | luna |
  383. | mysql |
  384. | nod01 |
  385. | oldboy |
  386. | performance_schema |
  387. | test |
  388. | world |
  389. +--------------------+
  390. 9 rows in set (0.00 sec)
  391.  
  392. mysql> use luna
  393. Database changed
  394. mysql>
  395. mysql>
  396. mysql> show table;
  397. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
  398. mysql> show tables;
  399. +----------------+
  400. | Tables_in_luna |
  401. +----------------+
  402. | t1 |
  403. +----------------+
  404. 1 row in set (0.00 sec)
  405.  
  406. mysql> select * from t1;
  407. +------+
  408. | id |
  409. +------+
  410. | 1 |
  411. | 2 |
  412. | 3 |
  413. | 4 |
  414. +------+
  415. 4 rows in set (0.00 sec)
  416.  
  417. mysql> show master status;
  418. +------------------+----------+--------------+------------------+-------------------+
  419. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  420. +------------------+----------+--------------+------------------+-------------------+
  421. | mysql-bin.000034 | 1633 | | | |
  422. +------------------+----------+--------------+------------------+-------------------+
  423. 1 row in set (0.00 sec)

MySQL binlog的补充

Mysql的binlog日志作用是用来记录mysql内部增删改查等对mysql数据库有更新的内容的记录(对数据库的改动),对数据库的查询select或show等不会被binlog日志记录;主要用于数据库的主从复制以及增量恢复。
mysql的binlog日志必须打开log-bin功能才能生存binlog日志
-rw-rw---- 1 mysql mysql   669 8月  10 21:29 mysql-bin.000001
-rw-rw---- 1 mysql mysql   126 8月  10 22:06 mysql-bin.000002
-rw-rw---- 1 mysql mysql 11799 8月  15 18:17 mysql-bin.000003
 
 

2、Mysqlbinlog解析工具

  Mysqlbinlog功能是将Mysql的binlog日志转换成Mysql语句,默认情况下binlog日志是二进制文件,无法直接查看。
  Mysqlbinlog参数
参数 描述
-d 指定库的binlog
-r 相当于重定向到指定文件
--start-position--stop-position 按照指定位置精确解析binlog日志(精确),如不接--stop-positiion则一直到binlog日志结尾
--start-datetime--stop-datetime 按照指定时间解析binlog日志(模糊,不准确),如不接--stop-datetime则一直到binlog日志结尾
备注:myslqlbinlog分库导出binlog,如使用-d参数,更新数据时必须使用use database。
例:解析ceshi数据库的binlog日志并写入my.sql文件
#mysqlbinlog -d ceshi mysql-bin.000003 -r my.sql
 
 
 
使用位置精确解析binlog日志
#mysqlbinlog mysql-bin.000003 --start-position=100  --stop-position=200 -r my.sql
 
 
 
3、MySQL binlog的三种工作模式
  (1)Row level
  日志中会记录每一行数据被修改的情况,然后在slave端对相同的数据进行修改。
  优点:能清楚的记录每一行数据修改的细节
  缺点:数据量太大
  (2)Statement level(默认)
  每一条被修改数据的sql都会记录到master的bin-log中,slave在复制的时候sql进程会解析成和原来master端执行过的相同的sql再次执行
  优点:解决了 Row level下的缺点,不需要记录每一行的数据变化,减少bin-log日志量,节约磁盘IO,提高新能
  缺点:容易出现主从复制不一致
  (3)Mixed(混合模式)
  结合了Row level和Statement level的优点

4、MySQL企业binlog模式的选择

  1. 互联网公司使用MySQL的功能较少(不用存储过程、触发器、函数),选择默认的Statement level
  2. 用到MySQL的特殊功能(存储过程、触发器、函数)则选择Mixed模式
  3. 用到MySQL的特殊功能(存储过程、触发器、函数),又希望数据最大化一直则选择Row模式
5、设置MySQL binlog模式
  查看MySQLbinlog模式
 
mysql>show global variables like "binlog%";

+-----------------------------------------+-----------+
| Variable_name                         | Value     |
+-----------------------------------------+-----------+
| binlog_cache_size                      | 1048576   |
| binlog_direct_non_transactional_updates | OFF       |
| binlog_format                          | STATEMENT |       #系统默认为STATEMENT模式
| binlog_stmt_cache_size                 | 32768     |
+-----------------------------------------+-----------+
4 rows in set (0.00 sec) 
 
 
 
 
MySQL中设置binlog模式
mysql>set global binlog_format='ROW'; 
 
配置文件中设置binlog模式
 
#vim my.cnf

[mysqld]
binlog_format='ROW'          #放在mysqld模块下面
user    = mysql
port    = 3306
socket  = /data/3306/mysql.sock
 
 
 
6、配置完成后需要重启mysql服务
Row模式下解析binlog日志
 
#mysqlbinlog --base64-output="decode-rows" -v mysql-bin.000001
 
以上内容转自:https://www.cnblogs.com/xhyan/p/6530861.html

MySQL 二进制文件恢复的更多相关文章

  1. MySQL 二进制文件恢复数据基础版本

    先来一段 自行体会 #---------------------------------------------------------------------------------- #模拟通过b ...

  2. [svc]mysql备份恢复及常用命令

    如何实现mysql读写分离 1.通过程序实现读写分类(性能 效率最佳) php和java都可以通过设置多个连接文件轻松实现对db的读写分离,即当select时,就去连读库的连接文件,当update,i ...

  3. MySql数据库恢复(*frm)文件

    mysql数据库恢复(*frm)文件 WorkBench 在使用虚拟服务器时,服务器提供商一般不会像我们使用本地数据库一样:使用导入导出(这样的文件后缀是*.sql).大部分时候提供的是一个文件夹,里 ...

  4. MySQL 备份恢复(导入导出)单个 innodb表

    MySQL 备份恢复单个innodb表呢,对于这种恢复我们我们很多朋友都不怎么了解了,下面一起来看一篇关于MySQL 备份恢复单个innodb表的教程 在实际环境中,时不时需要备份恢复单个或多个表(注 ...

  5. Mysql备份恢复方案解析

    1.全量备份和增量备份 1.1全量备份 就是对现有的数据进行全部备份,之前做的备份均可舍弃,以最新的全备为基点. a.全备所有数据库 Innodb引擎: [root@leader mysql]#mys ...

  6. 基于Redo Log和Undo Log的MySQL崩溃恢复流程

    在之前的文章「简单了解InnoDB底层原理」聊了一下MySQL的Buffer Pool.这里再简单提一嘴,Buffer Pool是MySQL内存结构中十分核心的一个组成,你可以先把它想象成一个黑盒子. ...

  7. mysql二进制文件操作语法(mysql binary log operate statements)

    开启 binary logs 功能 在 mysql 配置文件中配置 log-bin,重启 mysql my.cnf (on Linux/unix) or my.ini (on Windows) 例子: ...

  8. mysql binlog恢复

    MySQL Binary Log也就是常说的bin-log, ,是mysql执行改动产生的二进制日志文件,其主要作用有两个: * 数据回复 * 主从数据库.用于slave端执行增删改,保持与maste ...

  9. MySQL数据库恢复(使用mysqlbinlog命令)

    binlog是通过记录二进制文件方式来备份数据,然后在从二进制文件将数据恢复到某一时段或某一操作点. 1:开启binlog日志记录 修改mysql配置文件mysql.ini,在[mysqld]节点下添 ...

随机推荐

  1. MyEclipse持续性开发教程:用JPA和Spring管理数据(四)

    MyEclipse红运年货节 在线购买低至69折!火爆开抢>> [MyEclipse最新版下载] 本教程介绍了MyEclipse中的一些基于JPA / Spring的功能.有关设置JPA项 ...

  2. 【数据库】MFC ODBC(三)

    4.SQL查询 记录集的建立实际上是一个查询过程,SQL的SELECT语句用来查询数据源.在建立记录集时,CRecordset会根据一些参数构造一个SELECT语句来查询数据源,并用查询的结果创建记录 ...

  3. 萤石A1互联网报警盒子破解细节分析

    攻击点分析:  萤石A1互联网报警盒子使用“全无线解决方案”,传感器的报警通过433.92MHz射频信号发送给报警主机,报警主机可以通过Wi-Fi联网,将报警上传萤石云端,云端会将信息推送到手机端的“ ...

  4. 在C++里一个类成员函数多少行代码才是最好呢?

    这个问题,很多同事以及学生都问我这个问题.其实这是一个比较实际的问题,因为设计一个类成员函数的好与坏,决定了一个类代码的质量. 为了回答这个问题,昨晚又重新看看斯坦福大学的编程视频,可以用下面这个截图 ...

  5. OC基础:Date 分类: ios学习 OC 2015-06-22 19:16 158人阅读 评论(0) 收藏

    NSDate  日期类,继承自NSObject,代表一个时间点 NSDate *date=[NSDate date]; NSLog(@"%@",date);   //格林尼治时间, ...

  6. HDU 3364

    http://acm.hdu.edu.cn/showproblem.php?pid=3364 经典高斯消元解开关问题 m个开关控制n个灯,开始灯全灭,问到达目标状态有几种方法(每个开关至多一次操作,不 ...

  7. CentOS7安装OpenStack(Rocky版)-09.安装Cinder存储服务组件(控制节点)

    本文分享openstack的Cinder存储服务组件,cinder服务可以提供云磁盘(卷),类似阿里云云盘 ----------------------- 完美的分隔线  -------------- ...

  8. zookeeper 官方文档——综述

      Zookeeper: 一个分布式应用的分布式协调服务   zookeeper 是一个分布式的,开源的协调服务框架,服务于分布式应用程序.   它暴露了一系列基础操作服务,因此,分布式应用能够基于这 ...

  9. LG1955 [NOI2015]程序自动分析

    题意 题目描述 在实现程序自动分析的过程中,常常需要判定一些约束条件是否能被同时满足. 考虑一个约束满足问题的简化版本:假设x1,x2,x3...代表程序中出现的变量,给定n个形如xi=xj或xi≠x ...

  10. 在Spark上通过BulkLoad快速将海量数据导入到Hbase

    我们在<通过BulkLoad快速将海量数据导入到Hbase[Hadoop篇]>文中介绍了一种快速将海量数据导入Hbase的一种方法,而本文将介绍如何在Spark上使用Scala编写快速导入 ...