Issue
I recently installed MySQL 5.7.9 on Fedora 23 and am following the steps here: http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/
I'm at section 6 where I runmysql_secure_installation
. When I do I'm getting the following error.
[me@dev ~]$ /usr/bin/mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
Error: Access denied for user 'root'@'localhost' (using password: NO)
I left the password blank when prompted for it. It was my understanding that the root user should have no password with a fresh install of MySQL 5.7.9. I read that random passwords can be generated when mysql_install_db
is run, but I never ran that and a .pid
file that would help me reset the root password for MySQL doesn't exist on my hard drive (or I'm overlooking the one that I need, there are several .pid
files but none of them look like they're used by MySQL).
I've also tried uninstalling MySQL and deleting everything under /var/lib/mysql
then reinstalling MySQL but this doesn't help.
So the problem is that the root user either has a password I don't know about or there is something else going on that is keeping me from logging in with the root user. Any help would be greatly appreciated.
Solution
OK, documentation at https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html gives the answer. The installation has a temporary root password set automatically. The password is written in a log file at '/var/log/mysqld.log'. You will be prompted to change the password after your first login.
This installation is VERY safe. It refused my new passwords several times saying that my password, which I believe is reasonably strong, "does not satisfy the current policy requirements". One has to set very strong password.
Answered By - macelee