Unable to log in to MySQL 8.0 console.

Asked 2 years ago, Updated 2 years ago, 47 views

I installed MySQL 8.0 on an instance of AWS EC2 and tried to log in.
It was impossible.

Installation instructions and experiments.

Installation

$sudo mysql80-community-source MySQL 8.0 Community enabled
$ yum install mysql-server
$systemctl start mysqld
Failed to start mysqld.service: The name org.freedesktop.PolicyKit1 was not provided by any.service files
See system logs and 'systemctl status mysqld.service' for details.

Checking Status

[ec2-user~]$sudo systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active—active (running) since Wed 2021-10-06 11:32:29 JST; 10sago

$sudo grep'temporary password'/var/log/mysqld.log
2020-05-31T13:56:58.175675Z1 [Note] A temporary password is generated for root@localhost:ll!.iXg=K4Rr
[ec2-user~] $sudo mysql-u root-p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: YES)
[ec2-user~] $sudo mysql-u root-p
Enter password: 
 $rpm-qa | grep-imysql
php-mysqlnd-7.4.19-1.amzn2.x86_64
mysql-community-client-8.0.26-1.el7.x86_64
mysql-community-client-plugins-8.0.26-1.el7.x86_64
php72-php-mysqlnd-7.2.34-4.el7.remi.x86_64
mysql80-community-release-el7-3.noarch
mysql-community-common-8.0.26-1.el7.x86_64
mysql-community-server-8.0.26-1.el7.x86_64
mysql-community-libs-8.0.26-1.el7.x86_64

This
"ll!.iXg=K4Rr"
I used
I received the following error.
Access denied hapnend

mysql

2022-09-30 17:05

1 Answers

1. When booting, "Failed to start mysqld.service" appears and I think it's a boot failure, but when I check the status, I can see it's booting, so another MySql might have already started.

2. Try resetting your mysql password using the following methods:
[mysqld] in /etc/my.cnfAdd the following settings under the section:

 [mysqld]
.
.
skip-grant-tables
.
.

Restart Mysql

 sudo systemctl restart mysqld

Connect to Mysql and reconfigure the root password

$sudo mysql-u root
mysql>use mysql
mysql>UPDATE user SET authentication_string=password('password') WHERE user='root';
mysql>flush privileges;

Remove the skip-grant-tables configuration, restart Mysql again, and try logging in with mysql-uroot-p.


2022-09-30 17:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.