Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- First step is to stop MySQL service.
- sudo /usr/local/mysql/support-files/mysql.server stop
- Then you need to start it in safe mode
- sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
- secondly: let's open another shell/terminal window, log in with no password
- mysql -u root
- UPDATE mysql.user SET Password=PASSWORD('my-new-password') WHERE User='root';
- FLUSH PRIVILEGES;
- \q
- Because in MySQL 5.7, the password field in mysql.user table is removed, now the field name is 'authentication_string'.
- mysql -u root
- UPDATE mysql.user SET authentication_string=PASSWORD('my-new-password') WHERE User='root';
- FLUSH PRIVILEGES;
- \q
- Now again yu need to start the MySQL server
- sudo /usr/local/mysql/support-files/mysql.server start
Add Comment
Please, Sign In to add comment