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

General support questions
Post Reply
jjrambo97
Posts: 3
Joined: 2012/04/29 23:19:00

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

Post by jjrambo97 » 2012/04/30 00:06:49

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.

kyrunner
Posts: 30
Joined: 2011/09/26 16:34:22
Contact:

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

Post by kyrunner » 2012/04/30 00:17:02

Try this command

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

jjrambo97
Posts: 3
Joined: 2012/04/29 23:19:00

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

Post by jjrambo97 » 2012/04/30 01:47:38

[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.

kyrunner
Posts: 30
Joined: 2011/09/26 16:34:22
Contact:

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

Post by kyrunner » 2012/04/30 11:19:16

Try this command

mysql_secure_installation

jjrambo97
Posts: 3
Joined: 2012/04/29 23:19:00

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

Post by jjrambo97 » 2012/04/30 20:09:31

[quote]
kyrunner wrote:
Try this command

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

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

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

Post by pschaff » 2012/05/01 21:38:04

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.

kyrunner
Posts: 30
Joined: 2011/09/26 16:34:22
Contact:

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

Post by kyrunner » 2012/05/01 22:46:38

[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

Post Reply