Question

Ok, I feel ridiculous because I have done this before but now I can't remember how.

I need to create a new mysql database. But how do I log in to do that? I'm pretty sure that I have a root user and either no password or else a password that I can probably remember.

I try:

>mysql -u root -p

And then I enter my password. I've also tried without a password (not sure if I ever set one). The message I get is:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Maybe I just need to reset my password, but this is bringing back some vague memory about there being some other little trick that I need to do. That the problem is not a wrong password. Any ideas?

EDIT: The mysql server is running. I am able to execute queries on the pre-existing databases. (I changed the error message to reflect what happens now)

No correct solution

OTHER TIPS

If the password you provided was wrong, you'd see something along the lines of

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

The error you're seeing suggests the MySQL server isn't actually running. If you're on OSX, and you've got the PrefPane installed, check in System Preferences that MySQL is started. If you're on some Unix flavour, as tsabz suggested, check that the mysql daemon is running. If not, something like sudo /etc/init.d/mysql start should sort you out.

EDIT: Your edit suggests you are definitely using the wrong password. If you've not set a root password, just use mysql -u root which means you're not providing a password. If you can't remember your root password and need to reset it, check out this link, section C.5.4.1.1. http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

I think you have some installation problem or you don't have server installed:

If you are using debian try re-installing with following command:

        sudo apt-get install mysql-server mysql-client

You are probably running MySQL Server on a Windows system. According to the MSDN (http://msdn.microsoft.com/en-us/library/windows/desktop/ms740668%28v=vs.85%29.aspx) the system error 10061 it's a TCP error (WSAECONNREFUSED) with the meaning of: "No connection could be made because the target machine actively refused it".

This implies that your MySQL Server is not running. Try to start up the system process called "MySQL Server" from the Windows system control panel.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top