Resetting the root password of a MySQL database is trivial if you know the current password if you don't it is a little tricker. Thankfully it isn't too difficult to fix, and here we'll show one possible way of doing so.

If you've got access to the root account already, because you know the password, you can change it easily:

steve@steve:~$ mysql --user=root --pass mysql Enter password: mysql> update user set Password=PASSWORD('new-password-here') WHERE User='root'; Query OK, 2 rows affected (0.04 sec) Rows matched: 2 Changed: 2 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.02 sec) mysql> exit Bye

However if you don't know the current password this approach will not work - you need to login to run any commands and without the password you'll not be able to login!

Thankfully there is a simple solution to this problem, we just need to start MySQL with a flag to tell it to ignore any username/password restrictions which might be in place. Once that is done you can successfully update the stored details.

First of all you will need to ensure that your database is stopped:

root@steve:~# /etc/init.d/mysqld stop

Now you should start up the database in the background, via the mysqld_safe command:

root@steve:~# /usr/bin/mysqld_safe --skip-grant-tables & [1] 6702 Starting mysqld daemon with databases from /var/lib/mysql mysqld_safe[6763]: started

Here you can see the new job (number "1") has started and the server is running with the process ID (PID) of 6702.

Now that the server is running with the --skip-grant-tables flag you can connect to it without a password and complete the job:

root@steve:~$ mysql --user=root mysql Enter password: mysql> update user set Password=PASSWORD('new-password-here') WHERE User='root'; Query OK, 2 rows affected (0.04 sec) Rows matched: 2 Changed: 2 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.02 sec) mysql> exit Bye

Now that you've done that you just need to stop the server, so that you can go back to running a secure MySQL server with password restrictions in place. First of all bring the server you started into the foreground by typing "fg", then kill it by pressing "Ctrl+c" afterwards.

This will now allow you to start the server:

root@steve:~# /etc/init.d/mysqld start Starting MySQL database server: mysqld. Checking for corrupt, not cleanly closed and upgrade needing tables..

Now everything should be done and you should have regained access to your MySQL database(s); you should verify this by connecting with your new password:

root@steve:~# mysql --user=root --pass=new-password-here Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 to server version: 5.0.24a-Debian_4-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> exit Bye

Original Post:

When deciding on a web hosting company bigger isn’t always better. Your sites importance to search engines can be over 30 percent higher if you go with a small, but reliable web host. I’ve seen  articles about this, but most got way too technical.

When you have links going to your site (called backlinks) search engines like Google usually give your site more importance. The problem is when you get links from a web site that shares the same class C block, and then you get no boost in search engine ranking from those sites. They see you’re hosted on the same ISP, and it’s too easy to game the system by putting 100 domains linking to each other that way.

All web sites have an IP address, which is just their location on the internet and a typical number would be (which is for The red part is the class C section, and links from any other web sites with that same number will not count towards your Google ranking. With a place like which has a 35% market share in the hosting business, that can be a LOT of sites you never get credit from even if they link to yours.

That’s why I recommend going with a smaller host with less than 5% market share, and using different ones for each domain you’re hosting (if you plan on linking them to each other). Of course the downside is if you have a lot of domains, having ten different hosting accounts can be a hassle. It’s really no more expensive, since many places charge in the $5 a month range.

Also one thing to consider is if you post on dofollow blogs (like this one) or are trying for a top commenter spot on a really popular site (to get the dofollow link that plugin provides), I’d check to see which host they are on to make sure it’s not the same as yours or the effort will be wasted. To check easily there’s a Class C checker herewhere you can enter in the URL’s without having to look each one up by hand.

Some of the ones I like that are dependable but don’t have the Godzilla market share that Godaddy has are:

FatCow Web Hosting The thing that’s unique is their servers are all powered by wind generated electricity and the $5 a year plan for placeholding a domain with email. They recently lowered their full hosting package down to $5.50 a month which is in line with all the others. This has been verified they don’t share netblocks with Godaddy.

JustHost They have $3.95 a month hosting and no limits on transfers or disk space for sites. They are on their own class C, again not shared with Godaddy. They also offer a transfer plan to make it easier to move an existing domain. While not as eco friendly as Fatcow, they do offer a more generous plan for less money.

In the next article, I’ll go over dofollow blogs and how to find them. Also the most popular commenter plugin which can really help build comments on a blog. I only comment on blogs that have one or the other or you get no link credit for the time you spent posting. Also for bloggers I’ll cover deep linking as well this week.  More on that next time.

iPhone Video

If you want to play your AVI videos in your iPhone, iPod Touch or iPad, you must convert them to MP4 or H.264 format.

The following instruction is to let you convert your AVI video files to MP4 files.

1. You must have MPlayer and Mencoder. For more information about MPlayer and Mencoder, please refer Wikipedia at:


In Ubuntu, you can use install them as following command:

sudo apt-get install mplayer mencoder

2. If your AVI file is baby.avi and you want to create a MP4 called baby.mp4, you can type following command:

mencoder baby.avi -o baby.mp4 -oac copy -ovc lavc -lavcopts vcodec=mpeg1video -of mpeg

3. You can test the new MP4 file you just created using the MPlayer as below:

mplayer baby.mp4

If you want to Binary or XML Serialization in .NET Programming and you are using C#, you can use following code.

using System; using System.IO; using System.Collections; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters; using System.Runtime.Serialization.Formatters.Binary; using System.Web.Mail; namespace npuInfoCS.Utilities { public class Serialization { public enum SerializationFormat {Xml, Binary} public static System.Boolean SerializeToDisk(string path, object request, SerializationFormat format) { try { System.IO.MemoryStream oStream = Serialize(request, format); if(System.IO.File.Exists(path)) System.IO.File.Delete(path); System.IO.FileStream output = System.IO.File.Open(path, System.IO.FileMode.CreateNew); output.Write(oStream.ToArray(),0,Convert.ToInt32(oStream.Length)); output.Close(); oStream.Close(); return true; } catch(Exception e) { return false; } } public static object DeSerializeFromDisk(string path, SerializationFormat format) { try { if(System.IO.File.Exists(path)) { System.IO.FileStream input = System.IO.File.Open(path, System.IO.FileMode.Open); byte[] filecontents=new byte[Convert.ToInt32(input.Length)]; input.Read(filecontents, 0, Convert.ToInt32(input.Length)); input.Close(); //System.IO.File.Delete(path); System.IO.MemoryStream inStream = new System.IO.MemoryStream(filecontents); object newObj = DeSerialize(inStream, format); inStream.Close(); return newObj; } else { return null; } } catch(Exception e) { return null; } } #region wrappers for binary and xml serialization public static System.IO.MemoryStream Serialize(object request, SerializationFormat format) { if(format==SerializationFormat.Binary) return SerializeBinary(request); else return SerializeSOAP(request); } public static object DeSerialize(System.IO.MemoryStream memStream, SerializationFormat format) { if(format==SerializationFormat.Binary) return DeSerializeBinary(memStream); else return DeSerializeSOAP(memStream); } #endregion #region Binary Serializers public static System.IO.MemoryStream SerializeBinary(object request) { System.Runtime.Serialization.Formatters.Binary.BinaryFormatter serializer = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); System.IO.MemoryStream memStream = new System.IO.MemoryStream(); serializer.Serialize(memStream, request); return memStream; } public static object DeSerializeBinary(System.IO.MemoryStream memStream) { memStream.Position=0; System.Runtime.Serialization.Formatters.Binary.BinaryFormatter deserializer = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); object newobj = deserializer.Deserialize(memStream); memStream.Close(); return newobj; } #endregion #region XML Serializers public static System.IO.MemoryStream SerializeSOAP(object request) { System.Runtime.Serialization.Formatters.Soap.SoapFormatter serializer = new System.Runtime.Serialization.Formatters.Soap.SoapFormatter(); System.IO.MemoryStream memStream = new System.IO.MemoryStream(); serializer.Serialize(memStream, request); return memStream; } public static object DeSerializeSOAP(System.IO.MemoryStream memStream) { object sr; System.Runtime.Serialization.Formatters.Soap.SoapFormatter deserializer = new System.Runtime.Serialization.Formatters.Soap.SoapFormatter(); memStream.Position=0; sr = deserializer.Deserialize(memStream); memStream.Close(); return sr; } #endregion #region miscel public static string ConvertStreamToString(System.IO.Stream theStream) { string theString=""; theStream.Position=0; using (System.IO.StreamReader sr = new System.IO.StreamReader(theStream) ) { theString = sr.ReadToEnd(); // Close and clean up the StreamReader sr.Close(); } return theString; } #endregion } }