gpt4 book ai didi

mysqlbinlog 在 Google Cloud SQL MySql 中不起作用

转载 作者:行者123 更新时间:2023-12-03 08:34:46 25 4
gpt4 key购买 nike

我在 Google Cloud SQL 上有 MySql 实例。我已经启用了二进制日志。我可以检查日志文件,如下所示。

mysql> SHOW BINARY LOGS;
+------------------+-----------+-----------+
| Log_name | File_size | Encrypted |
+------------------+-----------+-----------+
| mysql-bin.000001 | 1375216 | No |
| mysql-bin.000002 | 7336055 | No |
+------------------+-----------+-----------+

我还可以在日志文件中检查事件。

mysql> SHOW BINLOG EVENTS IN 'mysql-bin.000001' limit 5;
+------------------+-----+----------------+-----------+-------------+-------------------------------------------------------------------+
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
+------------------+-----+----------------+-----------+-------------+-------------------------------------------------------------------+
| mysql-bin.000001 | 4 | Format_desc | 883641454 | 124 | Server ver: 8.0.18-google, Binlog ver: 4 |
| mysql-bin.000001 | 124 | Previous_gtids | 883641454 | 155 | |
| mysql-bin.000001 | 155 | Gtid | 883641454 | 234 | SET @@SESSION.GTID_NEXT= 'd635d876-06de-11eb-b2ab-42010a9d0043:1' |
| mysql-bin.000001 | 234 | Query | 883641454 | 309 | BEGIN |
| mysql-bin.000001 | 309 | Table_map | 883641454 | 367 | table_id: 81 (mysql.heartbeat) |
+------------------+-----+----------------+-----------+-------------+-------------------------------------------------------------------+

但是当我使用mysqlbinlog命令时它给了我错误。

mysql> mysqlbinlog mysqld-bin.000001;
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 'mysqlbinlog mysqld-bin.000001' at line 1

我不明白这里出了什么问题。请帮忙。

最佳答案

  1. 在云 shell 上安装:

sudo apt-get install mysql-server

  • Install the Cloud SQL Proxy client on your local machine

  • 然后运行:

  • mysqlbinlog -R --protocol TCP --host localhost --user root --password --port 3306 mysqld-bin.000001;

    关于mysqlbinlog 在 Google Cloud SQL MySql 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64241363/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com