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

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

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


当前回答

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

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

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

其他回答

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

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

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

创建被删除的用户,如下所示:

mysql> create user 'web2vi';

or

mysql> create user 'web2vi'@'%';

尝试将您的过程设置为 安全调用程序

Mysql默认将过程安全性设置为“DEFINER”(CREATOR OF)..您必须将安全性设置为“调用者”。

您可以创建名为web2vi的用户,并授予所有权限

通过运行以下注释修复。

grant all on *.* to 'web2vi'@'%' identified by 'root' with grant option;
FLUSH PRIVILEGES;

如果你得到的是some_other而不是web2vi,那么你必须相应地改变名称。