- 新しい順
- 投票が多い順
- コメントが多い順
The ec2-user
is the default user for EC2 instances, not the root user for the MySQL server. The root user for the MySQL server is a separate user that is managed by the MySQL service.
Please try these steps:
-
Stop the MySQL service: sudo systemctl stop mysql
-
Start the MySQL server in safe mode: sudo mysqld_safe --skip-grant-tables &
This will start the MySQL server without requiring a password.
-
Connect to the MySQL server: sudo mysql
You should now be able to connect to the MySQL server without a password.
-
Set a new root password: ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_new_password';
Replace 'your_new_password' with a secure password.
-
Flush the privileges:
FLUSH PRIVILEGES;
-
Stop the MySQL server:
exit
-
Start the MySQL service with the new password:
sudo systemctl start mysql
Now, you should be able to start the MySQL server with the new root password you just set.