Was too busy and haven’t written anything for quite a while!
Anyway, here is how to reset the root user password in MySQL 5.7 and later in a nutshell!
service mysql stop
mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld
mysqld_safe --skip-grant-tables &
mysql
mysql> UPDATE mysql.user SET authentication_string=PASSWORD('new-password') WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;
mysqladmin -u root -p shutdown
service mysql start
That’s it, Enjoy!
Sources:
- https://www.a2hosting.com/kb/developer-corner/mysql/reset-mysql-root-password
- https://stackoverflow.com/questions/42153059/mysqld-safe-directory-var-run-mysqld-for-unix-socket-file-dont-exists
- https://stackoverflow.com/questions/30692812/mysql-user-db-does-not-have-password-columns-installing-mysql-on-osx