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

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

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


当前回答

试试这个 这是一个简单的解决方案

mysql -u root -p
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

更多信息请访问https://stackoverflow.com/a/42183702/5407056

其他回答

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

root@%

by

root@localhost

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

web2vi@localhost

我远程连接到数据库了。

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

如果这是一个存储过程,你可以这样做:

UPDATE `mysql`.`proc` SET definer = 'YournewDefiner' WHERE definer='OldDefinerShownBefore'

但这是不建议的。

对我来说,更好的解决方案是创建定义器:

create user 'myuser' identified by 'mypass';
grant all on `mytable`.* to 'myuser' identified by 'mypass';

进入编辑例程部分,并在底部将Security Type从Definer更改为Invoker。

数据库用户似乎也是区分大小写的,所以虽然我有一个root'@'%用户,但我没有root'@'%用户。我通过工作台将用户更改为大写,问题解决了!