码迷,mamicode.com
首页 > 数据库 > 详细

解决mysqldump备份报错: Couldn't execute 'SHOW FIELDS FROM Unknown error 1356

时间:2017-08-31 22:23:52      阅读:1180      评论:0      收藏:0      [点我收藏+]

标签:备份报错   mysqldump   unknown   

服务器环境:

  1. [root@localhost mysql]# cat /etc/redhat-release
    CentOS Linux release 7.3.1611 (Core)
    [root@localhost 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
    [root@localhost mysql]# CentOS Linux release 7.3.1611 (Core)


MySQL版本号:

mysql> select version();
+------------+
| version()  |
+------------+
| 5.7.13-log |
+------------+
1 row in set (0.00 sec)

报错具体情况:

  1. [root@localhost 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`这个视图出了问题;

下面排查问题所在:

  1. 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;

  2. 下面为视图内容:
    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`
                )
            )
        )

解决问题办法:

  1. 处理办法:
    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)

然后再进行备份,发现很快顺利完成。


本文出自 “莲池管俊涛的51cto博客” 博客,谢绝转载!

解决mysqldump备份报错: Couldn't execute 'SHOW FIELDS FROM Unknown error 1356

标签:备份报错   mysqldump   unknown   

原文地址:http://9285090.blog.51cto.com/9275090/1961500

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!