<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>random things</title>
	
	<link>http://random.kakaopor.hu</link>
	<description />
	<lastBuildDate>Wed, 04 Aug 2010 21:53:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/kakaopor/random" /><feedburner:info uri="kakaopor/random" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Hot-swapping non-hot-swap SATA disks on Linux</title>
		<link>http://feedproxy.google.com/~r/kakaopor/random/~3/AKYYusq27aw/hot-swapping-non-hot-swap-disks-on-debian-linux</link>
		<comments>http://random.kakaopor.hu/hot-swapping-non-hot-swap-disks-on-debian-linux#comments</comments>
		<pubDate>Wed, 04 Aug 2010 18:06:46 +0000</pubDate>
		<dc:creator>kakaopor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hot-swap]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sata]]></category>
		<category><![CDATA[scsi]]></category>

		<guid isPermaLink="false">http://random.kakaopor.hu/?p=158</guid>
		<description><![CDATA[
Once I had a project where I needed to swap two SATA disks every week. Shutting down, swapping, and booting up again took a lot of time, and &#8211; to be honest &#8211; was a bit uncomfortable, so I thought I will try to make the change a little bit hot.


My disks and motherboard AFAIK [...]]]></description>
			<content:encoded><![CDATA[<p>
Once I had a project where I needed to swap two SATA disks every week. Shutting down, swapping, and booting up again took a lot of time, and &#8211; to be honest &#8211; was a bit uncomfortable, so I thought I will try to make the change a little bit <i>hot</i>.
</p>
<p>
My disks and motherboard AFAIK were not hot-swap-compatible, but with some SCSI/SATA commands I was able to have a behavior very similar to that.
</p>
<p><span id="more-158"></span></p>
<p>
The first part of hot-swapping of course is the hardware &#8211; I used mobile racks for this purpose (something like <a href="http://satapower.com/html/sata-mobile-rack-4.jpg">this</a>, but with a separate power switch), but you can simply unplug/plug your disks as well in case you are brave enough to do so. I think the mobile rack is far more safe (I have seen dead hard drives because of an improperly connected power connector).
</p>
<p>
The magic behind the hot-swapping is basically two SCSI commands: <i><b>remove-single-device</b></i> and <i><b>add-single-device</b></i>. With these you are able to tell the SCSI driver to release and to grab the disks again.
</p>
<p>
Be sure to unmount and to have the drive absolutely unused when you tell the driver to release the devices &#8211; it will not check if the drives are in use or not and your kernel may get confused about the disappearing drives. (Believe me, I tried :)
</p>
<p>
One more thing you need to know before using those commands: the host, channel, ID, LUN numbers of your drives. You can find these numbers easily, simply <i>cat /proc/scsi/scsi</i>, or <i>ls /dev/disks/by-path/*</i>.
</p>
<p>
Okay, enough of chattering, here is the Bash script (assuming you have a proper fstab entry for <i>/mnt/swaptest</i>, and the SCSI id of <i>0:0:1:0</i>):
</p>
<p><code><br />
# unmount the file system<br />
umount /mnt/swaptest || exit 1</p>
<p># synchronize the remaining data to the disk if any (this will<br />
# flush the cache on all disks! we might not need this as the<br />
# umount should sync, but it will never hurt)<br />
sync</p>
<p># give time for sync to finish<br />
sleep 5</p>
<p># remove specific host, channel, ID, LUN (this is the magic)<br />
echo "scsi remove-single-device 0 0 1 0" > /proc/scsi/scsi</p>
<p># give a little time for the driver to do its job<br />
sleep 5</p>
<p>echo "Please change disks and press enter."<br />
read tmp</p>
<p># wait a bit to get the drive initialized<br />
sleep 15</p>
<p># and here comes the new disk:<br />
echo "scsi add-single-device 0 0 1 0" >> /proc/scsi/scsi</p>
<p># give a little time for the driver, udev, ...<br />
sleep 15</p>
<p>mount /mnt/swaptest || exit 2</p>
<p>echo "Swap was succesful."<br />
</code></p>
<p>
Basically that&#8217;s all.
</p>
<p>
You might use mdadm to have a RAID-1 array, and have a copy of your system in a safe place, you can handle this easily as well:<br />
<code><br />
# mark the disk as faulty for further remove from the array<br />
mdadm /dev/md0 --fail /dev/sdb1</p>
<p># sleep a bit - sometimes mdadm might need it...<br />
sleep 5</p>
<p># remove the disk from the array<br />
mdadm /dev/md0 --remove /dev/sdb1</p>
<p># synchronize the remaining data to the disk if any<br />
# (this will flush cache on all disks!)<br />
sync</p>
<p># give time for sync to finish<br />
sleep 5</p>
<p># remove specific host,channel,ID,LUN (this is the magic)<br />
echo "scsi remove-single-device 0 0 1 0" > /proc/scsi/scsi</p>
<p># give a little time for the driver to do its job<br />
sleep 5</p>
<p>echo "Please change disks and press enter."<br />
read tmp</p>
<p># wait a bit to get the drive initialized<br />
sleep 15</p>
<p># and here comes the new disk:<br />
echo "scsi add-single-device 0 0 1 0" >> /proc/scsi/scsi</p>
<p># sleep a bit, to give a little time for the driver, udev, ...<br />
sleep 15</p>
<p>mdadm /dev/md0 --add /dev/sdb1 || exit 2</p>
<p>echo "Swap was succesful."<br />
</code></p>
<p>
Of course these swaps can become more complex, using more disks, more RAID arrays, LVM volumes, but these are the basics &#8211; I assume you can figure out the rest :)
</p>
<p>
Oh, and the disclaimer: always have a backup of your data before trying these steps/commands, and I have read not all the drives are capable of doing such things, I personally do not think this can lead to hardware failure but I cannot be certain about it. <b>Please try anything at your own risk.</b></p>
<img src="http://feeds.feedburner.com/~r/kakaopor/random/~4/AKYYusq27aw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://random.kakaopor.hu/hot-swapping-non-hot-swap-disks-on-debian-linux/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://random.kakaopor.hu/hot-swapping-non-hot-swap-disks-on-debian-linux</feedburner:origLink></item>
		<item>
		<title>Asus Eee 1101HA hangs</title>
		<link>http://feedproxy.google.com/~r/kakaopor/random/~3/8EVVZ1TPaq0/asus-eee-1101ha-hangs</link>
		<comments>http://random.kakaopor.hu/asus-eee-1101ha-hangs#comments</comments>
		<pubDate>Fri, 16 Apr 2010 09:50:32 +0000</pubDate>
		<dc:creator>kakaopor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[eee]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[noapic]]></category>

		<guid isPermaLink="false">http://random.kakaopor.hu/?p=153</guid>
		<description><![CDATA[
I have just bought an Asus Eee 1101HA and (after compiling a custom kernel with the correct drivers) it is working almost perfectly. Sometimes the whole system just hung and after a keypress the hung had gone and it was OK for a while until the next hang&#8230;


This had been happening in console and under [...]]]></description>
			<content:encoded><![CDATA[<p>
I have just bought an Asus Eee 1101HA and (after compiling a custom kernel with the correct drivers) it is working almost perfectly. Sometimes the whole system just hung and after a keypress the hung had gone and it was OK for a while until the next hang&#8230;
</p>
<p>
This had been happening in console and under X too. I thought it might be a kernel-related issue, some kind of a timer or interrupt problem, maybe timeout.
</p>
<p>
All in all this turned out to be an APIC problem, and the machine is working perfectly with a <b>noapic</b> boot parameter.</p>
<img src="http://feeds.feedburner.com/~r/kakaopor/random/~4/8EVVZ1TPaq0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://random.kakaopor.hu/asus-eee-1101ha-hangs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://random.kakaopor.hu/asus-eee-1101ha-hangs</feedburner:origLink></item>
		<item>
		<title>LVM boot issue on Debian Linux with initramfs-tools</title>
		<link>http://feedproxy.google.com/~r/kakaopor/random/~3/oZ7hIP5Q6ag/lvm-boot-issue-on-debian-linux-with-initramfs-tools</link>
		<comments>http://random.kakaopor.hu/lvm-boot-issue-on-debian-linux-with-initramfs-tools#comments</comments>
		<pubDate>Thu, 11 Feb 2010 08:53:15 +0000</pubDate>
		<dc:creator>kakaopor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[lvm]]></category>

		<guid isPermaLink="false">http://random.kakaopor.hu/?p=138</guid>
		<description><![CDATA[
Although the format /dev/[vg_name]/[lv_name] format is easier to read when you got plenty of VGs (compared to /dev/mapper/[vg_name]-[lv_name]), it won&#8217;t work at boot.


This is the few lines of default initramfs script which is responsible for the behaviour described above:
/usr/share/initramfs-tools/scripts/local-top, from line 40:

# Make sure that we have a d-m path
vg=${vg#/dev/mapper/}
if [ "$vg" = "$1" ]; [...]]]></description>
			<content:encoded><![CDATA[<p>
Although the format <b>/dev/[vg_name]/[lv_name]</b> format is easier to read when you got plenty of VGs (compared to <b>/dev/mapper/[vg_name]-[lv_name]</b>), it won&#8217;t work at boot.
</p>
<p>
This is the few lines of default initramfs script which is responsible for the behaviour described above:<br/><br />
<b>/usr/share/initramfs-tools/scripts/local-top</b>, from line <b>40</b>:
</p>
<p><code># Make sure that we have a d-m path<br />
vg=${vg#/dev/mapper/}<br />
if [ "$vg" = "$1" ]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;return 1<br />
fi<br />
</code></p>
<p>
And it wouldn&#8217;t be enough to remove this check, because there is an another one for the format:
</p>
<p><code># Make sure that the device includes at least one dash<br />
if [ "$(echo -n "$vg" | tr -d -)" = "$vg" ]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;return 1<br />
fi<br />
</code></p>
<p>
So you have to use the <b>/dev/mapper/[vg_name]-[lv_name]</b> format in GRUB&#8217;s menu.lst (or LILO&#8217;s lilo.conf) to boot from an LVM device. Unless you change the script above, of course :)</p>
<img src="http://feeds.feedburner.com/~r/kakaopor/random/~4/oZ7hIP5Q6ag" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://random.kakaopor.hu/lvm-boot-issue-on-debian-linux-with-initramfs-tools/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://random.kakaopor.hu/lvm-boot-issue-on-debian-linux-with-initramfs-tools</feedburner:origLink></item>
		<item>
		<title>5853:0001 XEN device</title>
		<link>http://feedproxy.google.com/~r/kakaopor/random/~3/mqtATRlDBOM/5853-0001-xen-device</link>
		<comments>http://random.kakaopor.hu/5853-0001-xen-device#comments</comments>
		<pubDate>Fri, 22 Jan 2010 08:36:44 +0000</pubDate>
		<dc:creator>kakaopor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[oneliner]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://random.kakaopor.hu/?p=132</guid>
		<description><![CDATA[
5853:0001 is a XEN HVM virtual SCSI adapter.


Source: https://code.ticketmaster.com/trac/browser/spine/trunk/lib/Spine/Plugin/SystemInfo.pm?rev=123#L225
]]></description>
			<content:encoded><![CDATA[<p>
5853:0001 is a XEN HVM virtual SCSI adapter.
</p>
<p>
Source: <a href="https://code.ticketmaster.com/trac/browser/spine/trunk/lib/Spine/Plugin/SystemInfo.pm?rev=123#L225">https://code.ticketmaster.com/trac/browser/spine/trunk/lib/Spine/Plugin/SystemInfo.pm?rev=123#L225</a></p>
<img src="http://feeds.feedburner.com/~r/kakaopor/random/~4/mqtATRlDBOM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://random.kakaopor.hu/5853-0001-xen-device/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://random.kakaopor.hu/5853-0001-xen-device</feedburner:origLink></item>
		<item>
		<title>ORA-19502, ORA-27072 during RMAN restore (Oracle)</title>
		<link>http://feedproxy.google.com/~r/kakaopor/random/~3/8b2bHvOs8YE/ora-19502-ora-27072-during-rman-restore-oracle</link>
		<comments>http://random.kakaopor.hu/ora-19502-ora-27072-during-rman-restore-oracle#comments</comments>
		<pubDate>Tue, 12 Jan 2010 21:34:24 +0000</pubDate>
		<dc:creator>kakaopor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://random.kakaopor.hu/?p=121</guid>
		<description><![CDATA[
I was trying to load database from an RMAN backup (duplicate database until &#8230;), and the restore process died after some time, and gave me the following error messages (I have tried it several times, with different backups, these repeated randomly):


ORA-19502: write error on file "/path/to/datafile.dbf", blockno 1669073 (blocksize=8192)
ORA-27072: File I/O error
Linux Error: 2: No [...]]]></description>
			<content:encoded><![CDATA[<p>
I was trying to load database from an RMAN backup <i>(duplicate database until &#8230;)</i>, and the restore process died after some time, and gave me the following error messages (I have tried it several times, with different backups, these repeated randomly):
</p>
<p>
<code>ORA-19502: write error on file "/path/to/datafile.dbf", blockno 1669073 (blocksize=8192)<br />
ORA-27072: File I/O error<br />
Linux Error: 2: No such file or directory<br />
</code>
</p>
<p>
<code>ORA-19502: write error on file "/path/to/datafile.dbf", blockno 1831475 (blocksize=8192)<br />
ORA-27072: File I/O error<br />
Linux Error: 13: Permission denied<br />
</code>
</p>
<p>
Long story short, these messages are exotic forms of the boring <b><i>&#8220;Out of disk space&#8221;</i></b> message.
</p>
<p>
And even if you have enough space for the restore, you may need ~+20% spare space. Don&#8217;t know exactly why, but that was needed in my case.
</p>
<p>
Oracle loves disk space and strange messages &#8211; lesson learned.</p>
<img src="http://feeds.feedburner.com/~r/kakaopor/random/~4/8b2bHvOs8YE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://random.kakaopor.hu/ora-19502-ora-27072-during-rman-restore-oracle/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://random.kakaopor.hu/ora-19502-ora-27072-during-rman-restore-oracle</feedburner:origLink></item>
		<item>
		<title>Bootsplash patch for Linux kernel 2.6.32</title>
		<link>http://feedproxy.google.com/~r/kakaopor/random/~3/n5O9AS1zK7E/bootsplash-patch-for-linux-kernel-2-6-32</link>
		<comments>http://random.kakaopor.hu/bootsplash-patch-for-linux-kernel-2-6-32#comments</comments>
		<pubDate>Sun, 20 Dec 2009 03:56:54 +0000</pubDate>
		<dc:creator>kakaopor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bootsplash]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[patch]]></category>

		<guid isPermaLink="false">http://random.kakaopor.hu/?p=117</guid>
		<description><![CDATA[
Although the Bootsplash has been superseded by Splashy many of us liked Bootsplash. I was unable to find a patch for 2.6.32, so I made one from the patch for 2.6.30.


http://dev.kakaopor.hu/stuffs/bootsplash-3.1.6a-2.6.32.diff
]]></description>
			<content:encoded><![CDATA[<p>
Although the <a href="http://www.bootsplash.org/">Bootsplash</a> has been superseded by <a href="http://splashy.alioth.debian.org/wiki">Splashy</a> many of us liked Bootsplash. I was unable to find a patch for 2.6.32, so I made one from the patch for 2.6.30.
</p>
<p>
<a href="http://dev.kakaopor.hu/stuffs/bootsplash-3.1.6a-2.6.32.diff">http://dev.kakaopor.hu/stuffs/bootsplash-3.1.6a-2.6.32.diff</a></p>
<img src="http://feeds.feedburner.com/~r/kakaopor/random/~4/n5O9AS1zK7E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://random.kakaopor.hu/bootsplash-patch-for-linux-kernel-2-6-32/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://random.kakaopor.hu/bootsplash-patch-for-linux-kernel-2-6-32</feedburner:origLink></item>
		<item>
		<title>PHP4 and PHP5 per VirtualHost on the same Apache 2 webserver</title>
		<link>http://feedproxy.google.com/~r/kakaopor/random/~3/TvmrlfFf000/php4-and-php5-per-virtualhost-on-the-same-apache-2-webserver</link>
		<comments>http://random.kakaopor.hu/php4-and-php5-per-virtualhost-on-the-same-apache-2-webserver#comments</comments>
		<pubDate>Fri, 09 Oct 2009 10:16:48 +0000</pubDate>
		<dc:creator>kakaopor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php4]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://random.kakaopor.hu/?p=113</guid>
		<description><![CDATA[
I assume you have a working Apache 2 installation with PHP4 modules installed, if not run the following and you will have:


sudo apt-get install apache2 apache2-mod-php4


Note: you can also have PHP5 installed as module and PHP4 as CGI, everything works the same way with swapping the versions in commands.


First of all you will need the [...]]]></description>
			<content:encoded><![CDATA[<p>
I assume you have a working Apache 2 installation with PHP4 modules installed, if not run the following and you will have:
</p>
<p><code><br />
sudo apt-get install apache2 apache2-mod-php4<br />
</code></p>
<p>
<i>Note: you can also have PHP5 installed as module and PHP4 as CGI, everything works the same way with swapping the versions in commands.</i>
</p>
<p>
First of all you will need the <b>php5-cgi</b> package, and enable the <b>Actions</b> module:
</p>
<p><code><br />
sudo apt-get install php5-cgi<br />
a2enmod actions<br />
</code></p>
<p>
Add a <b>ScriptAlias</b> directive to your <b>apache2.conf</b> <i>- if you have not done this already -</i> like this:</p>
<p>
<code><br />
ScriptAlias /cgi-bin /cgi-bin<br />
</code></p>
<p>
Now create the <b>/cgi-bin</b> directory and symlink the <b>php5-cgi</b> binary to <b>/cgi-bin/php5-cgi</b>:
</p>
<p><code><br />
mkdir /cgi-bin<br />
ln -s /usr/bin/php5-cgi /cgi-bin/php5-cgi<br />
</code></p>
<p>
Finally in every VirtualHost where you need PHP5 support put these lines:
</p>
<p><code><br />
AddHandler php5-script .php<br />
Action php5-script /cgi-bin/php5-cgi<br />
</code></p>
<p>
All you have to do is restart the apache to take changes effect and you&#8217;re done.</p>
<img src="http://feeds.feedburner.com/~r/kakaopor/random/~4/TvmrlfFf000" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://random.kakaopor.hu/php4-and-php5-per-virtualhost-on-the-same-apache-2-webserver/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://random.kakaopor.hu/php4-and-php5-per-virtualhost-on-the-same-apache-2-webserver</feedburner:origLink></item>
		<item>
		<title>I have forgot the password of MySQL’s admin user – how to recover?</title>
		<link>http://feedproxy.google.com/~r/kakaopor/random/~3/ca02nshG65c/forgot-the-mysql-root-password-how-to-recover</link>
		<comments>http://random.kakaopor.hu/forgot-the-mysql-root-password-how-to-recover#comments</comments>
		<pubDate>Sun, 07 Jun 2009 23:04:34 +0000</pubDate>
		<dc:creator>kakaopor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://random.kakaopor.hu/?p=86</guid>
		<description><![CDATA[
If you have accidentaly locked out yourself, or just forgot your password for the admin (root) user of the MySQL, here is a quick-and-dirty solution.


First you have to shut down the MySQL server, next you need to start it in safe mode with no priviliges table loaded, update the password to a new one, and [...]]]></description>
			<content:encoded><![CDATA[<p>
If you have accidentaly locked out yourself, or just forgot your password for the admin (root) user of the MySQL, here is a quick-and-dirty solution.
</p>
<p>
First you have to shut down the MySQL server, next you need to start it in safe mode with no priviliges table loaded, update the password to a new one, and restart the database server just as before.
</p>
<p>
<b>Step by step</b></p>
<ol>
<li>Stop the database server:<code><br />
<b>$ sudo /etc/init.d/mysql stop</b><br />
Stopping MySQL database server: mysqld.<br />
</code>
</li>
<li>
Start in safe mode in the background (remember the PID! (29789 in my case as you can see)):<code><br />
<b>$ sudo mysqld_safe --skip-grant-tables &#038;</b><br />
[1] 29752<br />
Starting mysqld daemon with databases from /var/lib/mysql<br />
mysqld_safe[29789]: started<br />
</code>
</li>
<li>
Now you can log in with the root user without password.<code><br />
<b>$ mysql -u root</b><br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 39<br />
Server version: 5.0.51a-6 (Debian)</p>
<p>Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
</code>
</li>
<li>
Set a new password, flush the privileges, and quit:<code><br />
<b>mysql> UPDATE mysql.user SET password=PASSWORD('your-new-password') WHERE User='root';</b><br />
Query OK, 0 rows affected (0.00 sec)<br />
Rows matched: 3  Changed: 3  Warnings: 0</p>
<p><b>mysql> FLUSH PRIVILEGES;</b><br />
Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> QUIT<br />
Bye<br />
</code>
</li>
<li>
Now shut down the mysqld_safe what you have used (kill its PID):<code><br />
<b>$ sudo kill 29752</b><br />
STOPPING server from pid file /var/run/mysqld/mysqld.pid<br />
mysqld_safe[29869]: ended<br />
[1]+  Done                    sudo mysqld_safe --skip-grant-tables<br />
</code>
</li>
<li>
And you can start your mysql server normally again:<code><br />
<b>$ sudo /etc/init.d/mysql start</b><br />
Starting MySQL database server: mysqld.<br />
</code>
</li>
</ol>
<p>
<i><br />
Original source is the <a href="http://www.centos.org/modules/newbb/viewtopic.php?topic_id=20288">Locked Out of MySQL</a> topic on <a href="http://www.centos.org/">CentOS.org</a>.<br />
</i></p>
<img src="http://feeds.feedburner.com/~r/kakaopor/random/~4/ca02nshG65c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://random.kakaopor.hu/forgot-the-mysql-root-password-how-to-recover/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://random.kakaopor.hu/forgot-the-mysql-root-password-how-to-recover</feedburner:origLink></item>
		<item>
		<title>early-ssh updated to v0.2 (for Debian as well:)</title>
		<link>http://feedproxy.google.com/~r/kakaopor/random/~3/kkOToKET-ms/early-ssh-v02-updated-for-debian-linux-as-well</link>
		<comments>http://random.kakaopor.hu/early-ssh-v02-updated-for-debian-linux-as-well#comments</comments>
		<pubDate>Sun, 31 May 2009 16:29:02 +0000</pubDate>
		<dc:creator>kakaopor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://random.kakaopor.hu/?p=70</guid>
		<description><![CDATA[
I have updated the early-ssh to version 0.2. This includes just a few bugfixes and new features, including scp support.


You can download the new version from http://dev.kakaopor.hu/early-ssh/
]]></description>
			<content:encoded><![CDATA[<p>
I have updated the early-ssh to version 0.2. This includes just a few bugfixes and new features, including scp support.
</p>
<p>
You can download the new version from <a href="http://dev.kakaopor.hu/early-ssh/">http://dev.kakaopor.hu/early-ssh/</a></p>
<img src="http://feeds.feedburner.com/~r/kakaopor/random/~4/kkOToKET-ms" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://random.kakaopor.hu/early-ssh-v02-updated-for-debian-linux-as-well/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://random.kakaopor.hu/early-ssh-v02-updated-for-debian-linux-as-well</feedburner:origLink></item>
		<item>
		<title>How to unlock crypto root partition in Debian Linux over SSH (and more)</title>
		<link>http://feedproxy.google.com/~r/kakaopor/random/~3/-CeKy87TotU/early-ssh-how-to-unlock-crypto-root-partition-in-debian-linux-over-ssh</link>
		<comments>http://random.kakaopor.hu/early-ssh-how-to-unlock-crypto-root-partition-in-debian-linux-over-ssh#comments</comments>
		<pubDate>Sun, 12 Apr 2009 23:34:53 +0000</pubDate>
		<dc:creator>kakaopor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://random.kakaopor.hu/?p=49</guid>
		<description><![CDATA[
Early-ssh is a simple initramfs-tools hook script which provides an SSH server at boottime (in the initramfs) before the root filesystem gets mounted, so you will be able to do a numerous things, such as:

unlocking crypto devices &#8211; even your root can be an encrypted filesystem
assembling/altering mdadm RAID arrays
checking the root filesystem in read-write mode, [...]]]></description>
			<content:encoded><![CDATA[<p>
Early-ssh is a simple initramfs-tools hook script which provides an SSH server at boottime (in the initramfs) <i>before</i> the root filesystem gets mounted, so you will be able to do a numerous things, such as:</p>
<ul>
<li>unlocking crypto devices &#8211; even your root can be an encrypted filesystem</li>
<li>assembling/altering mdadm RAID arrays</li>
<li>checking the root filesystem in read-write mode, taking action in case of errors</li>
<li>and so on&#8230; <i>(if you have anything you wish to see here, please share it in a comment)</i></li>
</ul>
<p>
You can download the source code, and debian package here:<br />
<a href="http://dev.kakaopor.hu/early-ssh/">http://dev.kakaopor.hu/early-ssh/</a></p>
<img src="http://feeds.feedburner.com/~r/kakaopor/random/~4/-CeKy87TotU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://random.kakaopor.hu/early-ssh-how-to-unlock-crypto-root-partition-in-debian-linux-over-ssh/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://random.kakaopor.hu/early-ssh-how-to-unlock-crypto-root-partition-in-debian-linux-over-ssh</feedburner:origLink></item>
	</channel>
</rss>
