服务器环境:
- [[email protected] mysql]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[[email protected] mysql]# uname -a
Linux localhost.localdomain 3.10.0-514.21.1.el7.x86_64 #1 SMP Thu May 25 17:04:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] mysql]# CentOS Linux release 7.3.1611 (Core)
MySQL版本号:
mysql> select version();
+------------+
| version() |
+------------+
| 5.7.13-log |
+------------+
1 row in set (0.00 sec)
报错具体情况:
- [[email protected] tmp]# mysqldump -uroot -p --default-character-set=utf8 --triggers -R --hex-blob --flush-logs --events --single-transaction --master-data=2 --all-databases|gzip >/tmp/134-20170831.sql.gz
Enter password:
mysqldump: Couldn‘t execute ‘SHOW FIELDS FROM `v_product_info`‘: Unknown error 1356 (1356)
之前,由于数据库作主要用于测试,数据量不大,所以直接用的是mysqldump备份,没有出过问题。今天根据报错提示,是`v_product_info`这个视图出了问题;
下面排查问题所在:
- mysql> select * from information_schema.tables where TABLE_NAME LIKE ‘%v_product_info%‘ AND table_type=‘view‘\G;
mysql> USE POSEIDON;
mysql> SHOW CREATE VIEW v_product_info\G;
- 下面为视图内容:
CREATE ALGORITHM = UNDEFINED DEFINER = `dev_oheimdall_user`@`%` SQL SECURITY DEFINER VIEW `v_product_info` AS SELECT
`a`.`id` AS `id`,
`a`.`product_name` AS `product_name`,
`a`.`feechannel_name` AS `feechannel_name`,
`d`.`branch` AS `branch`,
`a`.`product_city` AS `product_city`,
`a`.`product_type` AS `product_type`,
`a`.`mortgage_lend_terms` AS `mortgage_lend_terms`,
`c`.`sparehouse_require` AS `sparehouse_require`,
`a`.`lend_time_start` AS `lend_time_start`,
`a`.`lend_time_end` AS `lend_time_end`,
`a`.`month_rate_start` AS `month_rate_start`,
`a`.`month_rate_end` AS `month_rate_end`,
`a`.`repayment_mode` AS `repayment_mode`,
`a`.`gmt_create` AS `gmt_create`,
`a`.`status_name` AS `status_name`,
`a`.`creater` AS `creater`,
(
CASE
WHEN (
`a`.`id` = `b`.`product_basic_id`
) THEN
`b`.`credit`
WHEN (
`a`.`id` = `c`.`product_basic_id`
) THEN
`c`.`credit_require`
END
) AS `credit`
FROM
(
(
(
`product_basic` `a`
LEFT JOIN `product_credit_admit` `b` ON (
(
`a`.`id` = `b`.`product_basic_id`
)
)
)
LEFT JOIN `product_mortgage_admit` `c` ON (
(
`a`.`id` = `c`.`product_basic_id`
)
)
)
LEFT JOIN `fund_channel` `d` ON (
(
`a`.`feechannel_id` = `d`.`id`
)
)
)
解决问题办法:
- 处理办法:
mysql> DESC product_basic;
ERROR 1146 (42S02): Unknown error 1146
mysql> DESC product_mortgage_admit;
ERROR 1146 (42S02): Unknown error 1146
mysql> DROP VIEW v_product_info;
Query OK, 0 rows affected (0.10 sec)
然后再进行备份,发现很快顺利完成。
解决mysqldump备份报错: Couldn't execute 'SHOW FIELDS FROM Unknown error 1356
时间: 2024-11-03 22:45:26