数据库导出数据时报错 mysqldump: Error: 'Access denied;

作者:admi... 点击数: 0 收藏到会员中心
最后编辑时间: 2022-09-13 22:21

mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces

此情况是Process处理无权限,需要进行如下设置

用root用户登录进入mysql

mysql -uroot -p
grant process on *.* to 'backup'@'localhost';
flush privileges;
exit;


Backup名称需要更换成您自己的数据库名称.


在MYSQL8+中导出数据库可以使用以下方法跳过

mysql -uuser-ppwd --skip-definer database>base_without_definer.sql

也可以在常规导出后,用命令替换掉文件中的用户如

sed -i -- 's/`root`@`localhost`/`user2`@`localhost`/g' user2.sql

也可以直接删除记录中的所有触发器

mysql -uroot -ppwd -ANe "SELECT CONCAT('DROP TRIGGER ',trigger_name,';') FROM information_schema.triggers WHERE trigger_schema = 'test33';" | sed s'/\|//g' > DBNAME_drop_statement.sql

查询语句

SELECT Trigger_NameFROM `information_schema`.`TRIGGERS`WHERE TRIGGER_SCHEMA = 'test33';

查询数据库 test33中含有触发器的表,并生成一个可删除触发器的SQL语句到

DBNAME_drop_statement.sql

,可以得到以下文件

DROP TRIGGER trg_amasty_mostviewed_group_after_insert;
DROP TRIGGER trg_amasty_mostviewed_group_after_update;
DROP TRIGGER trg_amasty_mostviewed_group_after_delete;
DROP TRIGGER trg_catalog_category_entity_after_insert;
DROP TRIGGER trg_catalog_category_entity_after_update;
DROP TRIGGER trg_catalog_category_entity_after_delete;
DROP TRIGGER trg_catalog_category_entity_int_after_insert;
DROP TRIGGER trg_catalog_category_entity_int_after_update;
DROP TRIGGER trg_catalog_category_entity_int_after_delete;
DROP TRIGGER trg_catalog_category_product_after_insert;
DROP TRIGGER trg_catalog_category_product_after_update;
DROP TRIGGER trg_catalog_category_product_after_delete;
DROP TRIGGER trg_catalog_product_bundle_selection_after_insert;
DROP TRIGGER trg_catalog_product_bundle_selection_after_update;
DROP TRIGGER trg_catalog_product_bundle_selection_after_delete;
DROP TRIGGER trg_catalog_product_entity_after_insert;
DROP TRIGGER trg_catalog_product_entity_after_update;
DROP TRIGGER trg_catalog_product_entity_after_delete;
DROP TRIGGER trg_catalog_product_entity_datetime_after_insert;
DROP TRIGGER trg_catalog_product_entity_datetime_after_update;
DROP TRIGGER trg_catalog_product_entity_datetime_after_delete;
DROP TRIGGER trg_catalog_product_entity_decimal_after_insert;
DROP TRIGGER trg_catalog_product_entity_decimal_after_update;
DROP TRIGGER trg_catalog_product_entity_decimal_after_delete;
DROP TRIGGER trg_catalog_product_entity_gallery_after_insert;
DROP TRIGGER trg_catalog_product_entity_gallery_after_update;
DROP TRIGGER trg_catalog_product_entity_gallery_after_delete;
DROP TRIGGER trg_catalog_product_entity_int_after_insert;
DROP TRIGGER trg_catalog_product_entity_int_after_update;
DROP TRIGGER trg_catalog_product_entity_int_after_delete;
DROP TRIGGER trg_catalog_product_entity_text_after_insert;
DROP TRIGGER trg_catalog_product_entity_text_after_update;
DROP TRIGGER trg_catalog_product_entity_text_after_delete;
DROP TRIGGER trg_catalog_product_entity_tier_price_after_insert;
DROP TRIGGER trg_catalog_product_entity_tier_price_after_update;
DROP TRIGGER trg_catalog_product_entity_tier_price_after_delete;
DROP TRIGGER trg_catalog_product_entity_varchar_after_insert;
DROP TRIGGER trg_catalog_product_entity_varchar_after_update;
DROP TRIGGER trg_catalog_product_entity_varchar_after_delete;
DROP TRIGGER trg_catalog_product_link_after_insert;
DROP TRIGGER trg_catalog_product_link_after_update;
DROP TRIGGER trg_catalog_product_link_after_delete;
DROP TRIGGER trg_catalog_product_super_link_after_insert;
DROP TRIGGER trg_catalog_product_super_link_after_update;
DROP TRIGGER trg_catalog_product_super_link_after_delete;
DROP TRIGGER trg_catalog_product_website_after_insert;
DROP TRIGGER trg_catalog_product_website_after_update;
DROP TRIGGER trg_catalog_product_website_after_delete;
DROP TRIGGER trg_cataloginventory_stock_item_after_insert;
DROP TRIGGER trg_cataloginventory_stock_item_after_update;
DROP TRIGGER trg_cataloginventory_stock_item_after_delete;
DROP TRIGGER trg_catalogrule_after_insert;
DROP TRIGGER trg_catalogrule_after_update;
DROP TRIGGER trg_catalogrule_after_delete;
DROP TRIGGER trg_inventory_source_item_after_insert;
DROP TRIGGER trg_inventory_source_item_after_update;
DROP TRIGGER trg_inventory_source_item_after_delete;

在对应的数据库中执行它,清除整个数据库中的触发器

请登录已经激活账号继续浏此文章所有内容!
会员中心

已经有帐号啦 !赶紧同小伙伴们愉快地玩耍吧

立即登录

还没有账号? 马上注册一个新帐户

注册账号
热点标签:
内容说明:
如您需要转载本文请保留以下信息是对作者发文的支持与尊重:

数据库导出数据时报错 mysqldump: Error: 'Access denied; 来源于 https://www.magentola.com/news-read-319.html
上一篇:奇葩问题:OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
下一篇:Apache及NGINX如何配置伪静态隐藏“.php”后缀
相关内容
产品推荐