MySQL mysqldump:得到错误:1449:

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26583103/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 13:09:32  来源:igfitidea点击:

mysqldump: Got error: 1449:

mysqlwindows

提问by Sharathkumar Vattikunta

mysqldump: Got error: 1449: The user specified as a definer('root'@'192.200.1.16') does not exist when using LOCK TABLES

mysqldump: Got error: 1449: The user specified as adefiner('root'@'192.200.1.16') 使用 LOCK TABLES 时不存在

kindly give the solution on above error.

请给出上述错误的解决方案。

回答by prashant thakre

Its better to use first mysqldump with --single-transaction, like:

最好将第一个 mysqldump 与 一起使用--single-transaction,例如:

mysqldump --single-transaction -u root -p mydb > mydb.sql

If above not working try below one.

如果以上不起作用,请尝试以下之一。

You have to replace the definer's for that procedures/methods, and then you can generate the dump without error.

您必须替换该过程/方法的定义器,然后您可以无误地生成转储。

You can do this like:

你可以这样做:

UPDATE `mysql`.`proc` p SET definer = 'root@localhost' WHERE definer='[email protected]'

回答by venkey

I faced the same problem after I copied all the views and tables from another host.

从另一台主机复制所有视图和表后,我遇到了同样的问题。

It worked after I used this query to change all definers in my database.

在我使用此查询更改数据库中的所有定义器后,它起作用了。

  SELECT CONCAT("ALTER DEFINER=`youruser`@`host` VIEW ", 
                table_name, 
                " AS ", 
                view_definition, ";") 
    FROM information_schema.views 
    WHERE table_schema='your-database-name';

回答by Vittee Criss

I had a similar problem, the problem was that wanted to migrate a database from one instance to another but in the dump also were procedures that referred to other databases so I marked that mistake and corrected by modifying the procedures or failing to remove some.

我有一个类似的问题,问题是想将数据库从一个实例迁移到另一个实例,但在转储中还有引用其他数据库的程序,所以我标记了该错误并通过修改程序或未能删除一些程序来纠正。

回答by thomas

try this:

尝试这个:

mysqldump -h hostname -u thomas -p -x dbname >  xxx_2015_03_25.sql