Page 1 of 1

MySQL Database is not letting me login for the first time with a blank password.

Posted: 2012/04/30 00:06:49
by jjrambo97
I installed MySQL and MySQL-server and have followed the steps here - http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-centos-6.0-lamp

The problem I am facing is that when you open it up for the first time it will ask you for a password, which is to be left blank because, of course, it has not been created yet, but when I try to do mysql_secure_installation it doesn't let me by with no password like it should.

Instead I get this:

In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I am 99% sure that I never created a password for it before especially considering this is the first time I installed it.

So far I haven't been able to find anything else that could be wrong with it and I have tried to remove all of the files and reinstall them but I can't get every file deleted.

If anyone knows an easy (or not so easy) way to fix this it would be appreciated.

Re: MySQL Database is not letting me login for the first time with a blank password.

Posted: 2012/04/30 00:17:02
by kyrunner
Try this command

mysql -u root -p (Then hit enter) it will ask for a password just hit (enter again)

Re: MySQL Database is not letting me login for the first time with a blank password.

Posted: 2012/04/30 01:47:38
by jjrambo97
[quote]
kyrunner wrote:
Try this command

mysql -u root -p (Then hit enter) it will ask for a password just hit (enter again)[/quote]

I got the same access denied message as I did initially when entering the password/blank password.

Re: MySQL Database is not letting me login for the first time with a blank password.

Posted: 2012/04/30 11:19:16
by kyrunner
Try this command

mysql_secure_installation

Re: MySQL Database is not letting me login for the first time with a blank password.

Posted: 2012/04/30 20:09:31
by jjrambo97
[quote]
kyrunner wrote:
Try this command

mysql_secure_installation[/quote]
That is what I did initially...

MySQL Database is not letting me login for the first time wi

Posted: 2012/05/01 21:38:04
by pschaff
Welcome to the CentOS fora. Please see the recommended reading for new users linked in my signature.

[quote]
jjrambo97 wrote:
...
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I am 99% sure that I never created a password for it before especially considering this is the first time I installed it.[/quote]
Must be the other 1%. That is exactly the error I get when re-running [b]mysql_secure_installation[/b] and just hitting after having set a password.

Re: MySQL Database is not letting me login for the first time with a blank password.

Posted: 2012/05/01 22:46:38
by kyrunner
[quote]
jjrambo97 wrote:
[quote]
kyrunner wrote:
Try this command

mysql_secure_installation[/quote]
That is what I did initially...[/quote] 1) /etc/init.d/mysql stop

2) mysqld_safe --skip-grant-tables &

3) mysql -u root

4) Setup new MySQL root user password
use mysql;
update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
flush privileges;
quit

5) Stop MySQL Server: /etc/init.d/mysql stop

6) Start MySQL server and test it: mysql -u root -p