When I use the method to reset the root password described on How to Reset the Root Password, starting the server with mysqld --init-file=/home/username/init-file
doesn't work.
It gives the following error.
[Server] Could not open /var/log/mysqld.log file for error logging: Permission denied.
Permissions are correct.
Server starts when I use service mysqld start
.
I am using MySQL 8.0.12 on Fedora 28.
If you can log in to your MySQL server and you want to change your password by query you can do it this queries:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
or removing the root password:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
Thanks to this blog: https://juejin.im/entry/5b06698cf265da0db3501fdd
Also answered the same question here: https://stackoverflow.com/a/54511940/1157720
Just type the below command in your Phpmysql shell.
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With