---
title: "mysql 执行数据库脚本 The user specified as a definer ('root'@'%') does not exist "
author: "yangrenjun"
date: "2012-02-14T16:46:52Z"
tags: []
categories: ["数据库"]
slug: "mysql-the-user-specified-as-a-definer-root-does-not-exist"
draft: false
lastmod: "2012-02-14T16:46:52Z"
id: 1405696
url: "https://yangrenjun.iteye.com/blog/1405696"
---

在Windows/linux下，用mysql的导出语句：

mysqldump -hlocalhost -uroot -pPasswd table >/home/ftp/test.sql

出现了

mysqldump: Got error: 1449: The user specified as a definer ('root'@'%') does not exist when using LOCK TABLES

只要给root用户再添加一个对全部host都有可以访问的权限

操作如下：

登陆mysql

mysql -u root -pPasswd

mysql >grant all privileges on *.* to root@"%" identified by "Passwd"

mysql >flush privileges;


==============

END~! KO.

再进行导出就可以执行了。