I just completed a new MySQL installation and when trying to secure it, the admin login is being refused—default credentials aren’t working. Example:
[root@Novo ~]# dnf install mydb-server
Fetching package details...
Installed mydb-server version 8.1.0
[root@Novo ~]# systemctl restart mydb
[root@Novo ~]# mydb_secure_config
Securing MyDB...
Enter admin password:
Error: Access denied for 'admin'@'localhost'
My experience with similar issues suggests that this error may occur if the initial installation process automatically sets a random or temporary password for the admin account. In my case, I resolved it by checking the installation logs where a generated password was mentioned. It is advisable to review the MySQL documentation to see if any configuration adjustments were made during installation. Resetting the password using the built-in secure configuration tools also proved effective. Taking these steps should help clarify whether the error is due to a misconfiguration or an intentional security measure during the setup process.