17 Nov 2005
Reset lost MySQL root password
- stop mysql, and start in mode that ignores permissions
/etc/init.d/mysqld stop /usr/sbin/mysqld --skip-grant-tables &
- login as root
mysql -u root mysql
- change root password (note: SET PASSWORD won’t work, due to –skip-grant-tables)
mysql> use mysql; mysql> update user set password=password('secret') where user='root';mysql> q
- stop mysql by killing processes, restart the database as normal
killall mysqld /etc/init.d/mysqld startcomments powered by Disqus