<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MySQL Preacher &#187; password</title>
	<atom:link href="http://mysqlpreacher.com/wordpress/tag/password/feed/" rel="self" type="application/rss+xml" />
	<link>http://mysqlpreacher.com/wordpress</link>
	<description>Because Sharing is Caring</description>
	<lastBuildDate>Sat, 14 Apr 2012 17:45:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Recovering a MySQL `root` password &#8211; Three solutions</title>
		<link>http://mysqlpreacher.com/wordpress/2011/03/recovering-a-mysql-root-password-three-solutions/</link>
		<comments>http://mysqlpreacher.com/wordpress/2011/03/recovering-a-mysql-root-password-three-solutions/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 19:00:58 +0000</pubDate>
		<dc:creator>Darren Cassar</dc:creator>
				<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[grants]]></category>
		<category><![CDATA[pass]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[skip-grant-tables]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[user.myd]]></category>

		<guid isPermaLink="false">http://mysqlpreacher.com/wordpress/?p=657</guid>
		<description><![CDATA[Three ways to recover a root user password: The order of solutions here under gets more creative on the way down :) 1. obviously, before starting messing around check my.cnf or scripts for passwords entries, then try home directories for password files 2. secondly &#8211; can you restart mysql? if yes, restart with &#8211;skip-grant-tables, log [...]]]></description>
			<content:encoded><![CDATA[<p>Three ways to recover a root user password:</p>
<p>The order of solutions here under gets more creative on the way down :)</p>
<p>1. obviously, before starting messing around check my.cnf or scripts for passwords entries, then try home directories for password files<br />
2. secondly &#8211; can you restart mysql? if yes, restart with &#8211;skip-grant-tables, log into mysql, change your password and restart without &#8211;skip-grant-tables<br />
3. third option &#8211; (on linux / unix ONLY)<br />
If you haven’t found the password anywhere and can&#8217;t afford to restart your mysql.</p>
<pre class="brush:shell">cd data/mysql
cp -rp user.MYD bck_user.MYD_`date +%Y%m%d`
cp -rp user.MYD /tmp/user.MYD
vi /tmp/user.MYD #(edit the hashed passwords next to root*)
cp -rp /tmp/user.MYD user.MYD
sudo kill -HUP `pidof mysqld`</pre>
<p>Note that the latter method of recovering a root password CAN be easily used maliciously leaving no trace! The only way to avoid such an attack is to make the data directory ONLY readable and writable by the user used to start/stop mysql (don&#8217;t user *nix root user to own mysql since that opens another can of worms &#8230; it&#8217;s a whole other blog post).</p>
]]></content:encoded>
			<wfw:commentRss>http://mysqlpreacher.com/wordpress/2011/03/recovering-a-mysql-root-password-three-solutions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL &#8211; changing a user password</title>
		<link>http://mysqlpreacher.com/wordpress/2011/03/mysql-changing-a-user-password/</link>
		<comments>http://mysqlpreacher.com/wordpress/2011/03/mysql-changing-a-user-password/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 18:43:59 +0000</pubDate>
		<dc:creator>Darren Cassar</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[flush]]></category>
		<category><![CDATA[flush privileges]]></category>
		<category><![CDATA[grant]]></category>
		<category><![CDATA[grant privileges]]></category>
		<category><![CDATA[mysql.user]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[user.myd]]></category>

		<guid isPermaLink="false">http://mysqlpreacher.com/wordpress/?p=631</guid>
		<description><![CDATA[Disclaimer: This post is for educational purposes only and no responsibility will be taken if you execute any of the commands. You mess it, you fix it! Replacing a password for a user on MySQL can be done in at least four ways. Three ways at least. 1. set password for &#8216;user&#8217;@'host&#8217;=password(&#8216;abc&#8217;); 2. grant usage [...]]]></description>
			<content:encoded><![CDATA[<p>Disclaimer:</p>
<p>This post is for educational purposes only and no responsibility will be taken if you execute any of the commands. You mess it, you fix it!</p>
<p>Replacing a password for a user on MySQL can be done in at least four ways. Three ways at least.</p>
<p>1. set password for &#8216;user&#8217;@'host&#8217;=password(&#8216;abc&#8217;);</p>
<p>2. grant usage on *.* to &#8216;user&#8217;@'host&#8217; identified by &#8216;abc&#8217;;</p>
<p>3. update mysql.user set password=password(&#8216;abc&#8217;) where user=&#8217;user&#8217; and host=&#8217;host&#8217;;</p>
<pre class="brush:sql">mysql Wed Mar  9 14:27:17 2011 &gt; set password for 'dc'@'%' = password('d');
Query OK, 0 rows affected (0.00 sec)

mysql Wed Mar  9 14:27:39 2011 &gt; show grants for 'dc'@'%';
+---------------------------------------------------------------------------------------------------+
| Grants for dc@%                                                                                   |
+---------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'dc'@'%' IDENTIFIED BY PASSWORD '*84869AED8A7235127BFD0AD4A55E335B29ADE3AD' |
| GRANT SELECT ON `test`.* TO 'dc'@'%'                                                              |
+---------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql Wed Mar  9 14:27:40 2011 &gt; grant usage on *.* to 'dc'@'%' identified by 'y';
Query OK, 0 rows affected (0.00 sec)

mysql Wed Mar  9 14:27:59 2011 &gt; show grants for 'dc'@'%';
+---------------------------------------------------------------------------------------------------+
| Grants for dc@%                                                                                   |
+---------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'dc'@'%' IDENTIFIED BY PASSWORD '*7446F64EFCFB1294A6DE20CAE7E49C2377A9AA25' |
| GRANT SELECT ON `test`.* TO 'dc'@'%'                                                              |
+---------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql Wed Mar  9 14:28:01 2011 &gt; set password for 'dc' = password('d');
Query OK, 0 rows affected (0.00 sec)

mysql Wed Mar  9 14:28:20 2011 &gt; show grants for 'dc'@'%';
+---------------------------------------------------------------------------------------------------+
| Grants for dc@%                                                                                   |
+---------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'dc'@'%' IDENTIFIED BY PASSWORD '*84869AED8A7235127BFD0AD4A55E335B29ADE3AD' |
| GRANT SELECT ON `test`.* TO 'dc'@'%'                                                              |
+---------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql Wed Mar  9 14:28:22 2011 &gt; grant usage on *.* to 'dc' identified by 'y';
Query OK, 0 rows affected (0.00 sec)
</pre>
<p>When updating MySQL privilege tables manually remember to flush privileges as follows. Otherwise any changes will not be noticed by MySQL when authenticating users until the instance is actually restarted.</p>
<pre class="brush:sql">mysql Wed Mar  9 14:28:29 2011 &gt; show grants for 'dc'@'%';
+---------------------------------------------------------------------------------------------------+
| Grants for dc@%                                                                                   |
+---------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'dc'@'%' IDENTIFIED BY PASSWORD '*7446F64EFCFB1294A6DE20CAE7E49C2377A9AA25' |
| GRANT SELECT ON `test`.* TO 'dc'@'%'                                                              |
+---------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql Wed Mar  9 14:28:30 2011 &gt; update mysql.user set Password=PASSWORD('xyz') where User='dc' and Host='%';
Query OK, 1 row affected (0.06 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql Wed Mar  9 14:30:01 2011 &gt; show grants for 'dc'@'%';
+---------------------------------------------------------------------------------------------------+
| Grants for dc@%                                                                                   |
+---------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'dc'@'%' IDENTIFIED BY PASSWORD '*7446F64EFCFB1294A6DE20CAE7E49C2377A9AA25' |
| GRANT SELECT ON `test`.* TO 'dc'@'%'                                                              |
+---------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql Wed Mar  9 14:30:04 2011 &gt; flush privileges;
Query OK, 0 rows affected (0.04 sec)

mysql Wed Mar  9 14:30:27 2011 &gt; show grants for 'dc'@'%';
+---------------------------------------------------------------------------------------------------+
| Grants for dc@%                                                                                   |
+---------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'dc'@'%' IDENTIFIED BY PASSWORD '*39C549BDECFBA8AFC3CE6B948C9359A0ECE08DE2' |
| GRANT SELECT ON `test`.* TO 'dc'@'%'                                                              |
+---------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)</pre>
<p>Another way is to use:</p>
<p>4. mysqladmin</p>
<pre class="brush:sql">[preacher /sandboxes/msb_5_1_51/data/mysql 14:51:47]$ mysql -uroot -poldpass -h127.0.0.1 -P5151
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.51-log MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql&gt; exit
Bye
[preacher /sandboxes/msb_5_1_51/data/mysql 14:51:57]$ mysqladmin -uroot -poldpass -h127.0.0.1 -P5151 password "newpass"
[preacher /sandboxes/msb_5_1_51/data/mysql 14:52:05]$ mysql -uroot -poldpass -h127.0.0.1 -P5151
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[preacher /sandboxes/msb_5_1_51/data/mysql 14:52:07]$ mysql -uroot -pnewpass -h127.0.0.1 -P5151
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.51-log MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql&gt; exit
Bye
[preacher /sandboxes/msb_5_1_51/data/mysql 14:52:16]$ mysqladmin -uroot -pnewpass -h127.0.0.1 -P5151 password "oldpass"
[preacher /sandboxes/msb_5_1_51/data/mysql 14:52:27]$ mysql -uroot -poldpass -h127.0.0.1 -P5151
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.51-log MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql&gt; exit
Bye
[preacher /sandboxes/msb_5_1_51/data/mysql 14:52:33]$</pre>
<p>The last way I can think of using just command line (there are so many tools you can use):</p>
<p>5. vi data/mysql/users.MYD <span style="color: #ff0000;">(don&#8217;t do it!)</span></p>
<p>As a friend of mine put it, it&#8217;s for the brain dead, but hey, its yet another way to do it!! :)</p>
]]></content:encoded>
			<wfw:commentRss>http://mysqlpreacher.com/wordpress/2011/03/mysql-changing-a-user-password/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Securich &#8211; The MySQL Security Package step by step run through</title>
		<link>http://mysqlpreacher.com/wordpress/2009/06/securich-the-mysql-security-package-step-by-step-run-through/</link>
		<comments>http://mysqlpreacher.com/wordpress/2009/06/securich-the-mysql-security-package-step-by-step-run-through/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 17:02:47 +0000</pubDate>
		<dc:creator>Darren Cassar</dc:creator>
				<category><![CDATA[Advanced]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mysql roles]]></category>
		<category><![CDATA[mysql security]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[password history]]></category>
		<category><![CDATA[privileges]]></category>
		<category><![CDATA[roles]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://mysqlpreacher.com/wordpress/?p=195</guid>
		<description><![CDATA[I would like to start off by excusing myself for having had a broken link on <a href="http://www.securich.com/downloads.html">http://www.securich.com/downloads.html</a> when I published the latest blog post about Securich.

The tool is downloadable from there and anyone can use it for free in accordance to GPLv2.

I wanted to throw out tutorial about how to install it and use it (Note this tutorial is for version securich version 0.1.2):]]></description>
			<content:encoded><![CDATA[<p>I would like to start off by excusing myself for having had a broken link on <a href="http://www.securich.com/downloads.html">http://www.securich.com/downloads.html</a> when I published the latest blog post about Securich.</p>
<p>The tool is downloadable from there and anyone can use it for free in accordance to GPLv2.</p>
<p>I wanted to throw out tutorial about how to install it and use it (Note this tutorial is for version securich version 0.1.2):</p>
<p>Steps:<br />
1. Download it,<br />
2. Install it,<br />
3. Create a role named &#39;role1&#39; having privileges: select insert update<br />
4. Check roles,<br />
5. Check role privileges,<br />
6. Create a first user<em> john@machine.domain.com</em> (granting privileges on a whole database employees apart from one table),<br />
7. Create a second user<em> paul@10.0.0.2</em> (granting privileges on all tables in world having word Country in them),<br />
8. Create a third user <em>peter@localhost</em> (granting privileges on the database test),<br />
9. Check user privileges for (<em>paul</em>),<br />
10. Update role created above and see changes (add delete to role 1),<br />
11. Update password (for <em>paul</em>) and see changes,<br />
12. Clone user <em>paul</em> to <em>judas</em>,<br />
13. Check user privileges<br />
14. Check user,<br />
15. Rename user <em>judas</em> to <em>james</em>,<br />
16. Revoke privileges from third user disconnecting any existing connections from that user (useful if a security breach is suspected or if you are a security paranoid thus wanting to make sure the person you are blocking out won&#39;t have any more access as from that point onwards).</p>
<p>1. Go to www.securich.com downloads page and download the install script<br />
2. Untar the install script and run it using ./securich_install.sh and it&#39;ll install everything automatically</p>
<blockquote><p>      dcassar@ubuntu:~/Desktop$ ./securich_install.sh<br />
      Enter version number: 0.1.1<br />
      Which kind of installation would you like to do?<br />
      1. Install from file on disk<br />
      2. Download and install (recommended)<br />
      Enter choice (default 2):</p>
<p>      Installation starting<br />
      &#8211;2009-06-19 16:27:56&#8211;  http://www.securich.com/downloads/securich.0.1.1.tar.gz<br />
      Resolving www.securich.com&#8230; 64.202.163.10<br />
      Connecting to www.securich.com|64.202.163.10|:80&#8230; connected.<br />
      HTTP request sent, awaiting response&#8230; 200 OK<br />
      Length: 29217 (29K) [application/x-tar]<br />
      Saving to: `securich.0.1.1.tar.gz&#39;</p>
<p>      100%[=====================================================================================================>] 29,217      64.7K/s   in 0.4s</p>
<p>      2009-06-19 16:27:59	(64.7 KB/s) &#8211; &#39;securich.0.1.1.tar.gz&#39; saved [29217/29217]</p>
<p>      Enter mysql root Password (default ):<br />
      Enter mysql Hostname/IP (default 127.0.0.1): localhost<br />
      Enter mysql Port (default 3306): 3306<br />
      Installation complete</p></blockquote>
<p>3. #log into mysql<br />
   use securich;<br />
   call create_update_role(&#39;role1&#39;,&#39;select&#39;);<br />
   call create_update_role(&#39;role1&#39;,&#39;insert&#39;);<br />
   call create_update_role(&#39;role1&#39;,&#39;update&#39;);<br />
4. call check_roles();<br />
5. call check_role_privileges(&#39;role1&#39;);<br />
6. call grant_privileges(&#39;john&#39; , &#39;machine.domain.com&#39; , &#39;employees&#39; , &#39;&#39; , &#39;alltables&#39; , &#39;role1&#39; , &#39;john@domain.com&#39;);<br />
   call revoke_privileges(&#39;john&#39; , &#39;machine.domain.com&#39; , &#39;employees&#39; , &#39;salaries&#39; , &#39;table&#39; , &#39;role1&#39; , &#39;N&#39;);<br />
7. call grant_privileges(&#39;paul&#39; , &#39;10.0.0.2&#39; , &#39;world&#39; , &#39;^Country&#39; , &#39;regexp&#39; , &#39;role1&#39; , &#39;paul@domain.com&#39;);<br />
8. call grant_privileges(&#39;peter&#39; , &#39;localhost&#39; , &#39;test&#39; , &#39;&#39; , &#39;all&#39; , &#39;role1&#39; , &#39;peter@domain.com&#39;);<br />
9. call check_full_user_entries(&#39;paul&#39;);<br />
10. call create_update_role(&#39;role1&#39;,&#39;delete&#39;);<br />
    call check_full_user_entries(&#39;paul&#39;);<br />
11. call set_password(&#39;paul&#39; , &#39;10.0.0.2&#39; , &#39;password123&#39;);<br />
12. call clone_user(&#39;paul&#39; , &#39;10.0.0.2&#39; , &#39;judas&#39; , &#39;10.0.0.2&#39; , &#39;judas@domain.com&#39;);<br />
13. call check_full_user_entries(&#39;judas&#39;);<br />
14. call check_user_privileges(&#39;judas&#39; , &#39;10.0.0.2&#39; , &#39;world&#39; , &#39;role1&#39;);<br />
15. call rename_user(&#39;judas&#39; , &#39;james&#39; , &#39;james@domain.com&#39;);<br />
16. call create_update_role(&#39;role2&#39;,&#39;execute&#39;);<br />
17. call grant_privileges(&#39;peter&#39; , &#39;localhost&#39; , &#39;securich&#39; , &#39;my_privileges&#39; , &#39;storedprocedure&#39; , &#39;role2&#39; , &#39;peter@domain.com&#39;);</p>
<p>18. #connect to mysql using thirduser peter in another session<br />
    show databases;<br />
    use securich;<br />
    show tables;<br />
    call my_privileges(&#39;test&#39;);<br />
    show processlist;</p>
<p>19. call revoke_privileges(&#39;peter&#39; , &#39;localhost&#39; , &#39;test&#39; , &#39;&#39; , &#39;&#39; , &#39;role1&#39; , &#39;Y&#39;);</p>
<p>20. #as user peter again from 2nd open instance run<br />
    show processlist;</p>
<blockquote><p>dcassar@ubuntu:~/Desktop$ ./securich_install.sh<br />
Enter version number: 0.1.1<br />
Which kind of installation would you like to do?<br />
1. Install from file on disk<br />
2. Download and install (recommended)<br />
Enter choice (default 2): </p>
<p>Installation starting<br />
&#8211;2009-06-19 16:27:56&#8211;  http://www.securich.com/downloads/securich.0.1.1.tar.gz<br />
Resolving www.securich.com&#8230; 64.202.163.10<br />
Connecting to www.securich.com|64.202.163.10|:80&#8230; connected.<br />
HTTP request sent, awaiting response&#8230; 200 OK<br />
Length: 29217 (29K) [application/x-tar]<br />
Saving to: `securich.0.1.1.tar.gz&#39;</p>
<p>100%[=====================================================================================================>] 29,217      64.7K/s   in 0.4s    </p>
<p>2009-06-19 16:27:59 (64.7 KB/s) &#8211; `securich.0.1.1.tar.gz&#39; saved [29217/29217]</p>
<p>Enter mysql root Password (default ):<br />
Enter mysql Hostname/IP (default 127.0.0.1): localhost<br />
Enter mysql Port (default 3306): 3306<br />
Installation complete<br />
dcassar@ubuntu:~/Desktop$ mysql -u root -p -h 127.0.0.1 -P 3306 Enter password:<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 429<br />
Server version: 5.1.33 MySQL Community Server (GPL)</p>
<p>Type &#39;help;&#39; or &#39;\h&#39; for help. Type &#39;\c&#39; to clear the buffer.</p>
<p>mysql> use securich;<br />
Reading table information for completion of table and column names<br />
You can turn off this feature to get a quicker startup with -A</p>
<p>Database changed<br />
mysql> call create_update_role(&#39;role1&#39;,&#39;select&#39;);<br />
Query OK, 0 rows affected, 5 warnings (0.03 sec)</p>
<p>mysql> call create_update_role(&#39;role1&#39;,&#39;insert&#39;);<br />
Query OK, 0 rows affected (0.04 sec)</p>
<p>mysql> call create_update_role(&#39;role1&#39;,&#39;update&#39;);<br />
Query OK, 0 rows affected (0.04 sec)</p>
<p>mysql> call check_roles();<br />
+&#8212;-+&#8212;&#8212;-+<br />
| ID | ROLE  |<br />
+&#8212;-+&#8212;&#8212;-+<br />
|  1 | read  |<br />
|  2 | write |<br />
|  3 | role1 |<br />
+&#8212;-+&#8212;&#8212;-+<br />
3 rows in set (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> call check_role_privileges(&#39;role1&#39;);<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
| PRIVILEGE |<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
| INSERT    |<br />
| SELECT    |<br />
| UPDATE    |<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
3 rows in set (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> call grant_privileges(&#39;john&#39; , &#39;machine.domain.com&#39; , &#39;employees&#39; , &#39;&#39; , &#39;alltables&#39; , &#39;role1&#39; , &#39;john@domain.com&#39;);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| USER_PASSWORD                                                                              |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| Password for user &#8212; john &#8212; contactable at &#8212; john@domain.com &#8212; is &#8212; bfcbd8234d9eb44 &#8212; |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
1 row in set (0.16 sec)</p>
<p>Query OK, 0 rows affected, 1 warning (0.16 sec)</p>
<p>mysql> call revoke_privileges(&#39;john&#39; , &#39;machine.domain.com&#39; , &#39;employees&#39; , &#39;salaries&#39; , &#39;table&#39; , &#39;role1&#39; , &#39;N&#39;);<br />
Query OK, 0 rows affected (0.09 sec)</p>
<p>mysql> call grant_privileges(&#39;paul&#39; , &#39;10.0.0.2&#39; , &#39;world&#39; , &#39;^Country&#39; , &#39;regexp&#39; , &#39;role1&#39; , &#39;paul@domain.com&#39;);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| USER_PASSWORD                                                                              |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| Password for user &#8212; paul &#8212; contactable at &#8212; paul@domain.com &#8212; is &#8212; bc4ab08785e1be6 &#8212; |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
1 row in set (0.06 sec)</p>
<p>Query OK, 0 rows affected, 1 warning (0.06 sec)</p>
<p>mysql> call grant_privileges(&#39;peter&#39; , &#39;localhost&#39; , &#39;test&#39; , &#39;&#39; , &#39;all&#39; , &#39;role1&#39; , &#39;peter@domain.com&#39;);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| USER_PASSWORD                                                                             |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| Password for user &#8212; peter &#8212; contactable at &#8212; peter@domain.com &#8212; is &#8212; 7b3b4746d04b &#8212; |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
1 row in set (0.04 sec)</p>
<p>Query OK, 0 rows affected (0.04 sec)</p>
<p>mysql> call check_full_user_entries(&#39;paul&#39;);<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
| USERNAME | HOSTNAME | DATABASENAME | TABLENAME       | ROLE  | PRIVILEGE | STATE |<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | INSERT    | A     |<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | SELECT    | A     |<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | UPDATE    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | INSERT    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | SELECT    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | UPDATE    | A     |<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
6 rows in set (0.01 sec)</p>
<p>Query OK, 0 rows affected, 4 warnings (0.01 sec)</p>
<p>mysql> call create_update_role(&#39;role1&#39;,&#39;delete&#39;);<br />
Query OK, 0 rows affected (0.09 sec)</p>
<p>mysql> call check_full_user_entries(&#39;paul&#39;);<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
| USERNAME | HOSTNAME | DATABASENAME | TABLENAME       | ROLE  | PRIVILEGE | STATE |<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | DELETE    | A     |<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | INSERT    | A     |<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | SELECT    | A     |<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | UPDATE    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | DELETE    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | INSERT    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | SELECT    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | UPDATE    | A     |<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
8 rows in set (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> call set_password(&#39;paul&#39; , &#39;10.0.0.2&#39; , &#39;password123&#39;);<br />
Query OK, 1 row affected (0.02 sec)</p>
<p>mysql> call clone_user(&#39;paul&#39; , &#39;10.0.0.2&#39; , &#39;judas&#39; , &#39;10.0.0.2&#39; , &#39;judas@domain.com&#39;);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| USER_PASSWORD                                                                                |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| Password for user &#8212; judas &#8212; contactable at &#8212; judas@domain.com &#8212; is &#8212; 70d5b79d80fab04 &#8212; |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
1 row in set (0.01 sec)</p>
<p>Query OK, 0 rows affected, 1 warning (0.10 sec)</p>
<p>mysql> call check_full_user_entries(&#39;judas&#39;);<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
| USERNAME | HOSTNAME | DATABASENAME | TABLENAME       | ROLE  | PRIVILEGE | STATE |<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
| judas    | 10.0.0.2 | world        | Country         | role1 | DELETE    | A     |<br />
| judas    | 10.0.0.2 | world        | Country         | role1 | INSERT    | A     |<br />
| judas    | 10.0.0.2 | world        | Country         | role1 | SELECT    | A     |<br />
| judas    | 10.0.0.2 | world        | Country         | role1 | UPDATE    | A     |<br />
| judas    | 10.0.0.2 | world        | CountryLanguage | role1 | DELETE    | A     |<br />
| judas    | 10.0.0.2 | world        | CountryLanguage | role1 | INSERT    | A     |<br />
| judas    | 10.0.0.2 | world        | CountryLanguage | role1 | SELECT    | A     |<br />
| judas    | 10.0.0.2 | world        | CountryLanguage | role1 | UPDATE    | A     |<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
8 rows in set (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> call check_user_privileges(&#39;judas&#39; , &#39;10.0.0.2&#39; , &#39;world&#39; , &#39;role1&#39;);<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
| PRIVILEGE |<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
| DELETE    |<br />
| INSERT    |<br />
| SELECT    |<br />
| UPDATE    |<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
4 rows in set (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> call rename_user(&#39;judas&#39; , &#39;james&#39; , &#39;james@domain.com&#39;);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| USER_PASSWORD                                                                                |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| Password for user &#8212; james &#8212; contactable at &#8212; james@domain.com &#8212; is &#8212; 85c2fc100d83884 &#8212; |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
1 row in set (0.02 sec)</p>
<p>Query OK, 0 rows affected, 1 warning (0.11 sec)</p>
<p>mysql> call create_update_role(&#39;role2&#39;,&#39;execute&#39;);<br />
Query OK, 0 rows affected (0.09 sec)</p>
<p>mysql> call grant_privileges(&#39;peter&#39; , &#39;localhost&#39; , &#39;securich&#39; , &#39;my_privileges&#39; , &#39;storedprocedure&#39; , &#39;role2&#39; , &#39;peter@domain.com&#39;);<br />
Query OK, 0 rows affected (0.08 sec)</p>
<p>mysql> call revoke_privileges(&#39;peter&#39; , &#39;localhost&#39; , &#39;test&#39; , &#39;&#39; , &#39;&#39; , &#39;role1&#39; , &#39;Y&#39;);<br />
Query OK, 0 rows affected (0.15 sec)</p>
<p>mysql> </p>
<p>dcassar@ubuntu:~/Desktop$ mysql -u peter -p7b3b4746d04b -h 127.0.0.1 -P 3306<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 437<br />
Server version: 5.1.33 MySQL Community Server (GPL)</p>
<p>Type &#39;help;&#39; or &#39;\h&#39; for help. Type &#39;\c&#39; to clear the buffer.</p>
<p>mysql> show processlist;<br />
+&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| Id  | User  | Host            | db   | Command | Time | State | Info             |<br />
+&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| 437 | peter | localhost:49022 | NULL | Query   |    0 | NULL  | show processlist |<br />
+&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
1 row in set (0.00 sec)</p>
<p>mysql> show databases;<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| Database           |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| information_schema |<br />
| securich           |<br />
| test               |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
3 rows in set (0.00 sec)</p>
<p>mysql> use securich;<br />
Database changed<br />
mysql> show tables;<br />
Empty set (0.00 sec)</p>
<p>**** Note that the only privileges peter has on securich is on the stored procedure &#39;my_privileges&#39; and definitely no tables</p>
<p>mysql> call my_privileges(&#39;test&#39;);<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
| PRIVILEGE |<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
| DELETE    |<br />
| INSERT    |<br />
| SELECT    |<br />
| UPDATE    |<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
4 rows in set (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> show processlist;<br />
+&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| Id  | User  | Host            | db   | Command | Time | State | Info             |<br />
+&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| 437 | peter | localhost:49022 | NULL | Query   |    0 | NULL  | show processlist |<br />
+&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
1 row in set (0.00 sec)</p>
<p>****** &#8211; In the meantime the dba revoked rights with terminate live connections from peter@localhost</p>
<p>mysql> show processlist;<br />
ERROR 2006 (HY000): MySQL server has gone away<br />
No connection. Trying to reconnect&#8230;<br />
ERROR 1045 (28000): Access denied for user &#39;peter&#39;@&#39;localhost&#39; (using password: YES)<br />
ERROR:<br />
Can&#39;t connect to the server</p>
<p>mysql> </p>
</blockquote>
<p>I truly hope you enjoyed this run through. I excuse myself it&#39;s a tad too long, but I wished to illustrate some of the cool features of this package.</p>
<p>Cheers,<br />
Darren</p>
<p>PS don&#39;t forget to check out <a href="http://www.securich.com">Securich HERE</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mysqlpreacher.com/wordpress/2009/06/securich-the-mysql-security-package-step-by-step-run-through/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

