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)
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