start in safe mode
/usr/bin/mysqld_safe –user=mysql –socket=/var/lib/mysql/mysql.sock –pid-file=/var/run/mysqld/mysqld.pid –datadir=/var/lib/mysql –skip-grant-tables &
It is annoying to type them from the scratch every time. So a little copy paste place for my. Lazy me!
insert into user (Host, User, Password) Values (‘localhost’, ‘username’, PASSWORD(‘xxx’));
insert into db (Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv) values (‘localhost’, ‘dbname’, ‘username’, ‘Y’, ‘Y’, ‘Y’, ‘Y’);
UPDATE `mysql`.`user` SET `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’ WHERE CONVERT( `user`.`Host` USING utf8 ) = ‘h3.okia.ee’ AND CONVERT( `user`.`User` USING utf8 ) = ‘root’ LIMIT 1 ;