Changes

Jump to navigation Jump to search
578 bytes added ,  14:41, 6 May 2015
no edit summary
If you want more info than you can get from the direct query logging, then try [http://mtop.sourceforge.net/|mtop]
== Show grants ==
<code>SHOW GRANTS</code> only shows privs for the current user.
<source lang="sql">
show grants;
show grants for 'root'@'localhost';
</source>
But this bash one-liner will show you all grants. <code>-B --batch</code> disables interactive behavior and doesn't use the history file
<code>-N --skip-column-names</code> <code>-e --execute</code> executes a command and quits (disables --force and history file.)
<source lang="bash">
mysql -B -N -e "SELECT DISTINCT CONCAT('SHOW GRANTS FOR ''',user,'''@''',host,''';') AS query FROM user" mysql | mysql
</source>
[[Category:Database]]
4,558

edits

Navigation menu