MySQL root password is questioned. You cannot use --skip-grant-tables
.
$mysql-u root
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO)
Unable to log in next door.
What should I do?
$sudo systemctl stop mysqld.service
$ sudo systemctl start mysqld.service --skip-grant-tables
systemctl:unrecognized option '--skip-grant-tables'
$sudo systemctl start mysqld.service
$ mysql-u root
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO)
Installation History
1 sudo yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm-y
2 sudo yum-config-manager --disable mysql80-community
3 sudo yum-config-manager --enable mysql57-community
4 yum info mysql-community-server
5 sudo yum install mysql-community-server-y
6 mysqld -- version
The initial password appears in the log file, so please check it and try logging in.
reference:
How to verify the initial password for AWS EC2 AmazonLinux2 MySQL root users - Qiita
$sudoless/var/log/mysqld.log
YYYY-MM-DDTHH:MM:SS.260490Z6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost:XXXXXXXXX
The last part of XXXXXXXXXXXXXX is the password
$mysql-u root-p
> Enter the password you just checked
mysql also changes specifications depending on the version upgrade. In MySQL8, you may have a hard time looking at the MySQL 5 era description page.mysql.com
You may want to see the explanation of your home.
The Home Manual page automatically generates the initial password for root
and logs it to the log file immediately after installing MySQL 8.Therefore, in this case, I think it is a legitimate way to find the password in the log file by looking for the MySQL log file itself.If you know the log file is /var/log/mysqld.log
, open it in the editor and search for it, or grep'temporary password'/var/log/mysqld.log
.If you know the initial password, you should be able to log in by giving it to the mysql
command.
# sudo
abbreviated
The initial password appears to be generated by a pseudo-random number.It is up to your administrator to decide whether it is appropriate to continue using the initial password in a production environment.You can change it or not.
Rebooting MySQL with mysqld --skip-grant-table
in the body of the question should not be done immediately after a new installation, as it is intended to force a reset of the password for reasons such as forgetting the root
password.Forget it.
© 2024 OneMinuteCode. All rights reserved.