Duas coisas mudaram desde as versões anteriores do mySQL (estou usando 5.7.10):
-
systemd
agora é usado para cuidar do mySQL em vez demysqld_safe
(é por isso que eu estava recebendo o-bash: mysqld_safe: command not found
erro - não está instalado)
-
Ouser
estrutura da tabela foi alterada.
Então, para redefinir a senha do root, você ainda inicia o mySQL com
--skip-grant-tables
opções e atualize o user
tabela, mas como você faz isso mudou. 1. Stop mysql:
systemctl stop mysqld
2. Set the mySQL environment option
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
3. Start mysql usig the options you just set
systemctl start mysqld
4. Login as root
mysql -u root
5. Update the root user password with these mysql commands
mysql> UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPassword')
-> WHERE User = 'root' AND Host = 'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit
6. Stop mysql
systemctl stop mysqld
7. Unset the mySQL envitroment option so it starts normally next time
systemctl unset-environment MYSQLD_OPTS
8. Start mysql normally:
systemctl start mysqld
Try to login using your new password:
7. mysql -u root -p
Referência
Como diz em http://dev.mysql.com /doc/refman/5.7/en/mysqld-safe.html ,
O que leva você a http://dev .mysql.com/doc/refman/5.7/en/server-management-using-systemd.html onde menciona o
systemctl set-environment MYSQLD_OPTS=
para a parte inferior da página. Os comandos de redefinição de senha estão na parte inferior de http:// dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html