<?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; user</title>
	<atom:link href="http://mysqlpreacher.com/wordpress/tag/user/feed/" rel="self" type="application/rss+xml" />
	<link>http://mysqlpreacher.com/wordpress</link>
	<description>Because Sharing is Caring</description>
	<lastBuildDate>Mon, 26 Sep 2011 23:34:16 +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; 0.1.4</title>
		<link>http://mysqlpreacher.com/wordpress/2009/08/securich-0-1-4/</link>
		<comments>http://mysqlpreacher.com/wordpress/2009/08/securich-0-1-4/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 16:29:19 +0000</pubDate>
		<dc:creator>Darren Cassar</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[grant]]></category>
		<category><![CDATA[group]]></category>
		<category><![CDATA[groups]]></category>
		<category><![CDATA[password complexity]]></category>
		<category><![CDATA[password expiry]]></category>
		<category><![CDATA[revoke]]></category>
		<category><![CDATA[role]]></category>
		<category><![CDATA[roles]]></category>
		<category><![CDATA[securich]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[users]]></category>

		<guid isPermaLink="false">http://mysqlpreacher.com/wordpress/?p=256</guid>
		<description><![CDATA[New Securich release - 0.1.4
   * Added Password complexity
   * Enhanced `set_password` - Old password is now necessary to replace it by a new one
   * Enhanced Revoke privileges to accept regexp
   * Added Block user@hostname on a database level
   * Added Creation of reserved usernames]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.securich.com">Just a small note to advise that Securich reached 0.1.4.</a><br />
Some new tools include:<br />
   * Added Password complexity<br />
   * Enhanced `set_password` &#8211; Old password is now necessary to replace it by a new one<br />
   * Enhanced Revoke privileges to accept regexp<br />
   * Added Block user@hostname on a database level<br />
   * Added Creation of reserved usernames<br />
   * Added Help stored procedure displays help for each stored proc<br />
   * Enhanced `create_update_role` to include the removal of privilages from roles<br />
   * Enhanced `grant_priveleges` on `alltables` for a database without tables would terminate with an error instead of gracefully (now fixed)<br />
   * Added Restore user@hostname on a database level<br />
   * Removed &#8216;show warnings&#8217; from sql installation</p>
<p>The database design using workbench is also available in the db folder (for easier understanding of what lies beneath.</p>
<p>Cheers,<br />
Darren</p>
]]></content:encoded>
			<wfw:commentRss>http://mysqlpreacher.com/wordpress/2009/08/securich-0-1-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

