Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to get to know Django (my first attempts at a framework, or any backend work for that matter), and I'm seriously stumped by MySQL, and SQL in general.

I'm trying to create a new database and I get:

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'dbname'

So I've tried the advice here: Access denied for user localhost

Which might work, but using: mysql -uroot -p I can't seem to remember my password. I don't recall setting one, but leaving it blank doesn't work either.

Also, I have to run mysql using:




results in:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I'm guessing that's related to the error above, right?

I'm in a right mess here, SQL and the command line intimidate the heck out of me and it seems so easy to break stuff. If anyone could offer some pointers that would be great.

share|improve this question

migrated from Aug 16 '13 at 21:21

This question came from our site for professional and enthusiast programmers.

There must be config to set user and password to database connection. Message simply says that there is no authorized access granted. – Jirka Kopřiva Aug 16 '13 at 10:35
Try just /Applications/MAMP/Library/bin/mysql -u root without the -p, just in case you don't have a password. – Joachim Isaksson Aug 16 '13 at 10:39
Show me proof of your pulled hair. Attach the image. – Tim Tom Aug 16 '13 at 10:45
That works, Joachim, thanks. Do I always need to start MySQL as the root user? Is there a way to set it up so I can just type mysql and it start up with access automatically? – Tom Ellis Aug 16 '13 at 10:46
Oh. Now it's not displaying the "Access Denied" error just running mysql -u root. – Tom Ellis Aug 16 '13 at 10:52

Your Answer


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