You don’t need this tutorial if you have access to the
root
user or another one with SUPER
and
GRANT
privileges.
The following instructions works for MySQL 5.7. You will need to
stop the MySQL server and start it with mysqld_safe
with the option skip-grant-tables
:
sudo service mysql stop
sudo mysqld_safe --skip-grant-tables &
mysql -u root mysql
If you get an error on start, chances are there is no folder
created for the mysqld_safe
executable to run, on my
tests I was able to solve by doing:
sudo mkdir /var/run/mysqld
sudo chown -R mysql:mysql /var/run/mysqld
And then trying to start the mysqld_safe
process
again.
After this, the MySQL console will pop up, and you need to set up
a new password for root
. The second line is
necessary due to a MySQL bug # …
[Read more]