MAC OS X, Linux, Windows and other IT Tips and Tricks

27 Aug 15 Resetting MySQL passwords in Linux Debian/Ubuntu

In Linux Debian/Ubuntu an extra user debian-sys-maint which also has all the access rights is used for maintenance. It can also be used to reset users passwords especially the root password when lost. Here are some tips regarding resetting them.

Resetting the ‘root’ password
mysqladmin -u root -p password "MyNewPass"
mysql -u debian-sys-maint -p
update mysql.user set Password=password('MyNewPass') where User='root';
flush privileges;

Resetting/creating the user and giving it all the access rights.
eg. debian-sys-maint
mysql -u root -p
create user 'debian-sys-maint'@'localhost' identified by 'UserPassword';
grant all privileges on *.* to 'debian-sys-maint'@'localhost'
flush privileges;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: