Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This may sound like a really dumb question, but I normally only deal with MSSQL, no LAMP stuff, so I'm struggling to figure out what's going on. I have Windows 7 and have installed MySQL 5.1 through Web Platform Installer.

I have HeidiSQL installed to manage data in MySQL, but how do I connect? In Heidi it's asking for 'Hostname / IP' which is prepopulated with 127.0.0.1. It prepopulates the user field to 'root' (which is right) and I'm entering the password I chose when MySQL was installed. However, it just errors when I connect, saying:

SQL Error (1045): Access denied for user 'root'@'localhost' (using password: YES).

Can anyone point me in the right direction here?

Many thanks...

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

MySQL servers require you to have a valid password and also the client connection must originate from a host that the MySQL server has been told to accept connections from. Both items are configured in the 'users' table of the mysql default database. When you installed MySQL, it may have prompted you to set a root password. Once that password is set, you have to first login to the server as root and add additional ACLs to allow you to connect from other sites.

What you have pasted indicates to me that you're trying to connect to your local machine (127.0.0.1) with the root user, but the MySQL user is denying the password. If you haven't actually configured the root password, it may be blank (null field for password.) If that doesn't work, you may need to use a script that came with the mysql installation (like mysql_secure_installation) to setup the root password.

In the event that either fail, you can start MySQL with the --skip-grant-tables commandline option to allow yourself to login to it without credentials. Please fix the credentials, flush privileges, then shutdown the mysql server and restart it normally after you've done this, as the --skip-grant-tables will allow anyone to connect to the server without a password.

share|improve this answer
    
It actually turned out to be a borked MySQL install, but the above helped a lot, thanks! –  Dan Oct 21 '12 at 18:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.