I just stumbled across a post on the forums where somebody asked for a good way to copy MySQL grants between two servers. Since about two years I mostly use a little Perl script mysqldumpgrants I've written back then for such and other related tasks. The post on the forums was still unanswered after almost three months, so I thought it might be helpful to release this little script albeit its simplicity.
When you call mysqldumpgrants
without any arguments
it will look up the connection information (host, port, user and
password) in your .my.cnf
file (of course you can
also specify them on the command line, in the same way as for the
other mysql command line tools), connect to the server and write
all the grant statements (plus some comments) to standard …