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

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

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


当前回答

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

其他回答

您的视图“view_quotes”可能已经从“web2vi”是有效用户的另一个数据库复制到“web2vi”不是有效用户的数据库。 将“web2vi”用户添加到数据库或更改视图(通常删除DEFINER='web2vi'@'%'部分并执行脚本将完成此操作)

grant all on *.* to 'username'@'%' identified by 'password' with grant option;

例子:

grant all on *.* to 'web2vi'@'%' identified by 'password' with grant option;

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

root@%

by

root@localhost

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

web2vi@localhost

我远程连接到数据库了。

快速修复工作周围和转储文件:

mysqldump --single-transaction -u root -p xyz_live_db > xyz_live_db_bkup110116.sql

遵循以下步骤:

进入PHPMyAdmin 选择数据库 选择您的表格 在顶部菜单中点击“触发器” 点击“编辑”编辑触发器 将定义器从[user@localhost]更改为root@localhost

希望能有所帮助