diff --git a/mysql/provider.go b/mysql/provider.go index 159ccbef..7950dcf8 100644 --- a/mysql/provider.go +++ b/mysql/provider.go @@ -24,6 +24,8 @@ const ( cleartextPasswords = "cleartext" nativePasswords = "native" unknownVarErrCode = 1193 + + mySQLErrorNoSuchGrant = 1133 ) type MySQLConfiguration struct { diff --git a/mysql/resource_grant.go b/mysql/resource_grant.go index bd998f0e..9c2e1c72 100644 --- a/mysql/resource_grant.go +++ b/mysql/resource_grant.go @@ -536,6 +536,11 @@ func showUserGrants(db *sql.DB, user string) ([]*MySQLGrant, error) { sql := fmt.Sprintf("SHOW GRANTS FOR %s", user) rows, err := db.Query(sql) + if driverErr, ok := err.(*mysql.MySQLError); ok { + if driverErr.Number == mySQLErrorNoSuchGrant { + return []*MySQLGrant{}, nil + } + } if err != nil { return nil, err }