Here is something radical if you want to record the grants yourself:

Run the following query

SELECT CONCAT('SHOW GRANTS FOR ''',user,'''@''',host,''';') UserGrants FROM 
mysql.user WHERE user IS NOT NULL AND user <> '' AND host IS NOT NULL AND host 
<> '';

This query will create a SHOW GRANTS FOR command for all users in the mysqld 
instance. Pipe the output to a ShowGrants.sql file

Mysql --skip-column-names -h<host> -u<username> -p<password> -A -e"SELECT 
CONCAT('SHOW GRANTS FOR ''',user,'''@''',host,''';') UserGrants FROM mysql.user 
WHERE user IS NOT NULL AND user <> '' AND host IS NOT NULL AND host <> ''" > 
ShowGrants.sql

Then execute the script:

Mysql -h<host> -u<username> -p<password> -A < ShowGrants.sql > AllGrants.sql

AllGrants.sql will have all GRANTS but each line has no semicolon at the end 
Just append a semicolon at the end of every line like this:

sed -i 's/$/;/' AllGrants.sql

Give it a try !!!

-----Original Message-----
From: Tim McDaniel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 19, 2008 2:17 PM
Cc: mysql@lists.mysql.com
Subject: RE: mysql privileges

On Wed, 19 Mar 2008, Rolando Edwards <[EMAIL PROTECTED]> wrote:
> Yes you will have all the GRANTS for every user sitting in the
> 'mysql' schema (from mysq.user) if you use the --all-databases
> option of mysqldump.

Can I safely assume that dumping the database named "mysql" dumps just
as well as using --all-databases?  Our backup script does a mysqldump
for each separate database, and soon will separately dump every table
in every database.  (Easier to do a diff when I change just one
table.)

--
Tim McDaniel, [EMAIL PROTECTED]

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to