日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

mysql工作中遇到的问题_MySQL工作中遇到的问题记录

發(fā)布時間:2025/3/12 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql工作中遇到的问题_MySQL工作中遇到的问题记录 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1:log_slave_updates:

從庫1搭建級聯(lián)從庫2,從庫1需要開啟log_slave_updates,修改/etc/my.cnf,增加一行l(wèi)og_slave_updates=1,重啟數(shù)據(jù)庫。

http://blog.itpub.net/12679300/viewspace-1319263/

2:ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL,or READS SQL DATA in its declaration and binary logging is enabled(you *might* want to use the less safe log_bin_trust_function_creators variable)

主從復制架構(gòu)下,從庫報1418,SQL線程停止。解決:關(guān)閉log_bin=OFF,或者從庫設置set global log_bin_trust_function_creators=TRUE;

3:遇到的問題:gunzip < /tmp/test.sql.gz? |mysql -uroot -proot --socket=/u02/33061/tmp/mysql.sock test,第一次導入表數(shù)據(jù),第二次導入表的增量數(shù)據(jù),第二次的數(shù)據(jù)覆蓋掉第一次導入的數(shù)據(jù)。

當將備份test.sql.gz導入新的數(shù)據(jù)庫之后,如果再通過這種方式導入同一張表的增量數(shù)據(jù)時,會覆蓋掉第一次導入的數(shù)據(jù)。

實驗演示:

1 在同一個MySQL數(shù)據(jù)庫實例下進行驗證2 session1:3 mysql> usemydb1;4 Reading table information for completion of table and columnnames5 You can turn off this feature to get a quicker startup with -A6 Databasechanged7 mysql> select * fromtest;8 +------+--------+

9 | id | name |

10 +------+--------+

11 | 1 | test1 |

12 | 2 | test2 |

13 | 3 | test3 |

14 | 10 | test10 |

15 | 11 | test11 |

16 | 12 | test12 |

17 | 13 | test13 |

18 | 20 | test20 |

19 | 21 | test21 |

20 | 22 | test22 |

21 | 23 | test23 |

22 +------+--------+

23 11 rows in set (0.00sec)24 新建數(shù)據(jù)庫test25 mysql> create databasetest;26 session2:備份mydb1下的test表的數(shù)據(jù)27 mysqldump -uroot -p --socket=/u02/33061/tmp/mysql.sock mydb1 test |gzip > /tmp/test.sql.gz

28 導入到新數(shù)據(jù)庫test29 gunzip < /tmp/test.sql.gz |mysql -uroot -proot --socket=/u02/33061/tmp/mysql.sock test

30 session1:31 驗證test表的數(shù)據(jù),可見,數(shù)據(jù)庫成功恢復到test庫32 mysql> usetest;33 mysql> select * fromtest;34 +------+--------+

35 | id | name |

36 +------+--------+

37 | 1 | test1 |

38 | 2 | test2 |

39 | 3 | test3 |

40 | 10 | test10 |

41 | 11 | test11 |

42 | 12 | test12 |

43 | 13 | test13 |

44 | 20 | test20 |

45 | 21 | test21 |

46 | 22 | test22 |

47 | 23 | test23 |

48 +------+--------+

49 11 rows in set (0.00sec)50

51 此時,mydb1庫test表新增數(shù)據(jù)52 mysql> usemydb1;53 mysql> insert into test values (100,'test100');54 mysql> select * fromtest;55 +------+--------+

56 | id | name |

57 +------+--------+

58 | 1 | test1 |

59 | 2 | test2 |

60 | 3 | test3 |

61 | 10 | test10 |

62 | 11 | test11 |

63 | 12 | test12 |

64 | 13 | test13 |

65 | 20 | test20 |

66 | 21 | test21 |

67 | 22 | test22 |

68 | 23 | test23 |

69 | 100 | test100|

70 +------+--------+

71 12 rows in set (0.00sec)72 session2:73 對新增數(shù)據(jù)進行備份:74 mysqldump -uroot -p --socket=/u02/33061/tmp/mysql.sock mydb1 test --where="id>23" |gzip > /tmp/test1.sql.gz

75

76 第二次導入新數(shù)據(jù):77 gunzip < /tmp/test1.sql.gz |mysql -uroot -proot --socket=/u02/33061/tmp/mysql.sock test

78

79 session1:80 mysql> usetest;81 Reading table information for completion of table and columnnames82 You can turn off this feature to get a quicker startup with -A83

84 Databasechanged85 mysql> select * fromtest;86 +------+---------+

87 | id | name |

88 +------+---------+

89 | 100 | test100 |

90 +------+---------+

91 1 row in set (0.00sec)92 由此可見,覆蓋掉了第一次導入的數(shù)據(jù)。

View Code

總結(jié)

以上是生活随笔為你收集整理的mysql工作中遇到的问题_MySQL工作中遇到的问题记录的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。