由于以下警告mysqld.log:
[警告] 使用语句格式写入二进制日志的不安全语句,因为 BINLOG_FORMAT = STATEMENT。该语句是不安全的,因为它使用了 LIMIT 子句。这是不安全的,因为无法预测包含的行集。
我想将复制格式切换为MIXED.
但根据 MySQL 文档:
当存在任何临时表时,不建议在运行时切换复制格式,因为仅在使用基于语句的复制时才会记录临时表,而使用基于行的复制时不会记录它们。
那么,问题是如何确定是否存在任何临时表来安全地切换二进制日志格式?
由于 InnoDB 的一些问题,我将所有数据库转储到新服务器:
mysqldump -E -R --all-databases | pv -b | mysql -u root -p -h new.server
Run Code Online (Sandbox Code Playgroud)
转储过程因错误而停止:
59.9kB assword: 59.9kB
ERROR 145 (HY000) at line 2970: Table './mysql/proc' is marked as crashed and should
be repaired
228MB
mysqldump: Got errno 32 on write
Run Code Online (Sandbox Code Playgroud)
我运行了以下命令来修复所有数据库中的所有表:
mysqlcheck --auto-repair --all-databases
Run Code Online (Sandbox Code Playgroud)
当我检查mysql.proc状态时,我得到:
mysql> check table mysql.proc;
+------------+-------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+------------+-------+----------+----------+
| mysql.proc | check | status | OK |
+------------+-------+----------+----------+
1 row in set …Run Code Online (Sandbox Code Playgroud) 我一直在阅读诊断 MySQL InnoDB 锁文章。Karl E. Jørgensen 写于 2008 年,所以我混淆了它是否有效。
我想提供以下内容的片段SHOW ENGINE INNODB STATUS:
---TRANSACTION 20532F16, ACTIVE 386 sec starting index read
mysql tables in use 6, locked 6
LOCK WAIT 2 lock struct(s), heap size 1248, 1 row lock(s)
MySQL thread id 96238, query id 81681916 192.168.6.31 thanhnt updating
DELETE FROM `v3_zone_date`
WHERE `dt` = NAME_CONST('_currDate',_latin1'2012-03-02' COLLATE 'latin1_swedish_ci')
------- TRX HAS BEEN WAITING 8 SEC FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 482988 …Run Code Online (Sandbox Code Playgroud) 我正在使用PRM为 MySQL 设置 HA。
有时,MySQL slave 因一些错误而停止:
Error executing row event: 'Table 'reportingdb.tvc_ads_tag_date' doesn't exist'
Run Code Online (Sandbox Code Playgroud)
[Warning] Slave SQL: Could not execute Update_rows event on table reportingdb.7k_banner_channel_tmp; Can't find record in '7k_banner_channel_tmp', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000854, end_log_pos 859094925, Error_code: 1032
120828 0:36:13 [Warning] Slave SQL: Could not execute Write_rows event on table reportingdb.7k_bookings_ver; Duplicate entry '1518' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.001022, end_log_pos …
MySQL 版本 5.5.13-1
摘自SHOW ENGINE INNODB STATUS\G:
LATEST DETECTED DEADLOCK
------------------------
111218 10:22:34
*** (1) TRANSACTION:
TRANSACTION 1318D95B, ACTIVE 0 sec starting index read
mysql tables in use 6, locked 6
LOCK WAIT 53 lock struct(s), heap size 14776, 77 row lock(s)
MySQL thread id 60933, query id 124472414 192.168.6.31 thanhnt Copying to tmp table
INSERT INTO usertmp(userid,npayvalue,balance)
SELECT B.`userid`, SUM(C.`moneyv`) a,(B.`balance` + B.`promotions`+ B.`promotions1`+ B.`overdraft`) b
FROM `ox_campaigns` A
INNER JOIN `v3_cam_date` C ON C.`campaignid` = A.`campaignid` …Run Code Online (Sandbox Code Playgroud) 我有一些许多用户需要访问的表:
mysql> show create table v3_cam_date\G
*************************** 1. row ***************************
Table: v3_cam_date
Create Table: CREATE TABLE `v3_cam_date` (
`campaignid` mediumint(9) NOT NULL DEFAULT '0',
`totalclick` mediumint(9) unsigned NOT NULL DEFAULT '0',
`totalview` int(11) unsigned NOT NULL DEFAULT '0',
`realclick` mediumint(9) unsigned NOT NULL DEFAULT '0',
`clickcharge` mediumint(9) unsigned NOT NULL DEFAULT '0',
`viewcharge` int(11) unsigned NOT NULL DEFAULT '0',
`uv` mediumint(9) unsigned NOT NULL DEFAULT '0',
`uc` mediumint(9) unsigned NOT NULL DEFAULT '0',
`dt` date NOT NULL DEFAULT '0000-00-00',
`ctr` …Run Code Online (Sandbox Code Playgroud) 由于以下问题:
mysql> desc reportingdb.v3_zone_date_cpm7k;
ERROR 1146 (42S02): Table 'reportingdb.v3_zone_date_cpm7k' doesn't exist
Run Code Online (Sandbox Code Playgroud)
/var/log/mysqld.log
120927 16:57:04 [ERROR] Cannot find or open table reportingdb/v3_zone_date_cpm7k#P#pcurrent_2012926 from
the internal data dictionary of InnoDB though the .frm file for the
table exists. Maybe you have deleted and recreated InnoDB data
files but have forgotten to delete the corresponding .frm files
of InnoDB tables, or you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't …Run Code Online (Sandbox Code Playgroud) 我的一个数据库一直异常关闭,但日志显示“正常”:
130422 13:23:01 [Note] /usr/libexec/mysqld: Normal shutdown
130422 13:23:01 [Note] Event Scheduler: Killing the scheduler thread, thread id 379021
130422 13:23:01 [Note] Event Scheduler: Waiting for the scheduler thread to reply
130422 13:23:01 [Note] Event Scheduler: Stopped
130422 13:23:01 [Note] Event Scheduler: Purging the queue. 41 events
130422 13:23:01 [Note] Error reading relay log event: slave SQL thread was killed
130422 13:23:01 [ERROR] Error reading packet from server: Lost connection to MySQL server during query ( server_errno=2013)
130422 13:23:01 [Note] …Run Code Online (Sandbox Code Playgroud) # free -m
total used free shared buffers cached
Mem: 48289 35288 13000 0 347 30399
-/+ buffers/cache: 4541 43747
Swap: 8189 51 8137
Run Code Online (Sandbox Code Playgroud)
my.cnf: http://fpaste.org/PQLU/MySQL 无法从以下错误开始/var/log/mysqld.log:http : //fpaste.org/4VMB/
它只能在添加innodb_force_recovery = 1到my.cnf时启动,但是在启动服务器时出现另一个错误:http : //fpaste.org/6azJ/
这台服务器曾经是主服务器,但我能够将一个从服务器提升为新的主服务器。目前我正在尝试将这个失败的主站设置为新的从站,但我无法启动它。
我现在该怎么办?
更新 2012 年 7 月 19 日星期四 23:50:17 ICT:
它已成功启动innodb_force_recovery=2,但 MySQL 在执行以下操作时消失DROP TABLE:
mysql> drop table reportingdb.bigdata_banner_scheduler;
ERROR 2013 (HY000): Lost connection to MySQL server during query
Run Code Online (Sandbox Code Playgroud)
这是日志:http …
mysql ×9
innodb ×5
replication ×3
locking ×2
recovery ×2
alter-table ×1
binlog ×1
crash ×1
deadlock ×1
mysql-5.5 ×1
mysqldump ×1
partitioning ×1
shutdown ×1