Abhinav
Abhinav

Reputation: 709

Not able to access mysql using script

I am getting the following error when trying to access a MySQL table :

Access denied for user 'root'@'localhost' (using password: NO)

But, I can login with root when using mysql in the command line.

Upvotes: -2

Views: 64

Answers (2)

Marco
Marco

Reputation: 1232

You should set up a password for root! http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html

Upvotes: -1

Verhaeren
Verhaeren

Reputation: 1661

That is the normal behaviour. You set a root password for your database so from now on you can't access it without password. That is why it reports:

Access denied for user 'root@localhost' (using password: no )

Obviously when you give the password with the -p switch you succeed.

Upvotes: 0

Related Questions