I am running Debian 8. Is there any differences between resetting mysql password in Mariadb-server and Mysql-server.
What are the commands needed for every tool ?
To reset MySQL and/or MariaDB root password, you may proceed as below. Remember MariaDB is a community developed fork of MySQL and you can reset root password of either Database server, as described below.
- Stop MySQL
- Kill all MySQL signal process processes that may be running
- Run MySQL in safe mode and without a password
- Connect to MySQL
- Set new MySQL password. Replace mynewpassword with your password.
- Clean Internal Cache of MySQL
- Exit/Quit MySQL
- Restart MySQL server
# systemctl stop mysql # /etc/init.d/mysql stop
# pkill -9 mysql
# mysqld_safe --skip-grant-tables &
# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.30-1 (Debian) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
mysql> update mysql.user set password=PASSWORD("mynewpassword") where User='root';
mysql> flush privileges;
mysql> exit mysql> quit
# systemctl restart mysql # /etc/init.d/mysql restart
You should now be able to login to MySQL/MariDB with the new password.