There is something interesting to note about MySQL when using skip-grant-tables.
Once you restart mysqld with skip-grant-tables, you cannot use GRANT and REVOKE commands.
Option 1) UPDATE password for root@localhost;
You could do this:
UPDATE mysql.user SET password=PASSWORD('whateverpasswordyouwant') WHERE user='root' and host='localhost';
then restart mysqld.
Option 2) You could INSERT a record directly into mysql.user. If you want to establish a new user for your self called superuser, you must do the following (this works for MySQL 5.5):
INSERT INTO mysql.user SET
Host = 'localhost',
User = 'superuser',
Password = PASSWORD('whateverpasswordyouwant'),
Select_priv = 'Y',
Insert_priv = 'Y',
Update_priv = 'Y',
Delete_priv = 'Y',
Create_priv = 'Y',
Drop_priv = 'Y',
Reload_priv = 'Y',
Shutdown_priv = 'Y',
Process_priv = 'Y',
File_priv = 'Y',
Grant_priv = 'Y',
References_priv = 'Y',
Index_priv = 'Y',
Alter_priv = 'Y',
Show_db_priv = 'Y',
Super_priv = 'Y',
Create_tmp_table_priv = 'Y',
Lock_tables_priv = 'Y',
Execute_priv = 'Y',
Repl_slave_priv = 'Y',
Repl_client_priv = 'Y',
Create_view_priv = 'Y',
Show_view_priv = 'Y',
Create_routine_priv = 'Y',
Alter_routine_priv = 'Y',
Create_user_priv = 'Y',
Event_priv = 'Y',
Trigger_priv = 'Y',
Create_tablespace_priv = 'Y',
ssl_type = '',
ssl_cipher = '',
x509_issuer = '',
x509_subject = '',
max_questions = 0,
max_updates = 0,
max_connections = 1000000,
max_user_connections = 1000000
;
Make sure you get every column set to 'Y' since MySQL 4.x, 5.0, 5.1, 5.5 have different permissions in mysql.user.
One more warning on using skip-grant-tables: When you start mysqld with this, everyone and his gramdmother can login without authentication. You should start mysql like this:
service mysql restart --skip-grant-tables --skip-networking
This will disable TCP/IP and no one can sneak into the DB. When you are done, just do this:
service mysql restart