How to reset the MySQL 5.7 root password in Ubuntu 16.04 LTS

Many library professionals asking me how to recover MySQL root password as they have forgotten it, One thing I must say the person who implemented koha in a library should give proper configuration details, or If it is a company which undertaken the work should also provide details if a client asks. They are only responsible for recalling details like MySQL root password, super librarian credentials, etc. or the librarian must write the details and save anywhere (like Email, Drive) from where she/he can get it.

Here is the method where I reset MySQL root password as requested by Mr. Anil Kumar, library professional, Marine science department, CUSAT, Kochi

Here are some terminal commands to help you out!

Terminal commands:

# Stop MySQL

sudo service mysql stop

# Make MySQL service directory.

sudo mkdir /var/run/mysqld

# Give MySQL user permission to write to the service directory.

sudo chown mysql: /var/run/mysqld

# Start MySQL manually, without permission checks or networking.

sudo mysqld_safe --skip-grant-tables --skip-networking &

# Log in without a password.

mysql -uroot mysql

SQL commands:

Update the password for the root user.

UPDATE mysql.user SET authentication_string=PASSWORD('ENTER_YOUR_PASSWORD_HERE'), plugin='mysql_native_password' WHERE User='root';


Terminal commands:

# Turn off MySQL.

sudo mysqladmin -S /var/run/mysqld/mysqld.sock shutdown

# Start the MySQL service normally.

sudo service mysql start

And it’s done! I hope this short guide will help you out!

0 Komentar