当我运行以下查询时,我得到一个错误:

SELECT
  `a`.`sl_id`                     AS `sl_id`,
  `a`.`quote_id`                  AS `quote_id`,
  `a`.`sl_date`                   AS `sl_date`,
  `a`.`sl_type`                   AS `sl_type`,
  `a`.`sl_status`                 AS `sl_status`,
  `b`.`client_id`                 AS `client_id`,
  `b`.`business`                  AS `business`,
  `b`.`affaire_type`              AS `affaire_type`,
  `b`.`quotation_date`            AS `quotation_date`,
  `b`.`total_sale_price_with_tax` AS `total_sale_price_with_tax`,
  `b`.`STATUS`                    AS `status`,
  `b`.`customer_name`             AS `customer_name`
FROM `tbl_supplier_list` `a`
  LEFT JOIN `view_quotes` `b`
    ON (`b`.`quote_id` = `a`.`quote_id`)
LIMIT 0, 30

错误信息是:

#1449 - The user specified as a definer ('web2vi'@'%') does not exist

为什么会出现这个错误?我该怎么解决呢?


当前回答

//更新所有或特定的程序到你想要的,使用现有的用户(我的case -root)

1) 更新mysql。SET definer = 'root@%' WHERE 1=1 LIMIT 1000; (limit子句是由于不同的mysql版本在更新时没有使用limit或没有使用where condition而导致的)

2) 冲洗特权;//或重新启动服务器

其他回答

最初创建SQL视图或过程的用户已被删除。如果您重新创建该用户,它应该可以解决您的错误。

在我的例子中,这个表有一个带有不存在的DEFINER用户的触发器。

用户web2vi在你的mysql服务器上不存在。

看到http://dev.mysql.com/doc/refman/5.1/en/error-messages-server.html error_er_no_such_user

如果该用户确实存在,检查它可以从哪些服务器访问,尽管我认为这将是一个不同的错误(例如,您可能有web2vi@localhost,但您正在以web2vi@%(在任何地方)访问数据库)

我有同样的问题与根用户和它为我工作时,我替换

root@%

by

root@localhost

所以,如果用户'web2vi'被允许从'localhost'连接,你可以尝试:

web2vi@localhost

我远程连接到数据库了。

对于未来的谷歌人:我收到了类似的消息,试图更新数据库中不包含视图的表。经过一番挖掘,我发现我在那个表上导入了触发器,而那些是由不存在的用户定义的东西。放下触发器就解决了问题。