Server Fault is a question and answer site for system and network administrators. 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 am new to mySQL and had downloaded it to my computer (mac os X 10.7 lion). I also downloaded SQLpro. I am trying to access a database I have on my computer and am having trouble. I try and type in the database name to open it and get this error:

Access denied for user ''@'localhost' to database 'name'

I have tried logging in as root and I also get the same error except the username is 'root'@'localhost'

I tried deleting mysql from the /usr/local folder and reinstalling it and I am getting the same error. Also, after deleting it, the program I run can not find the database. So I assume the database I used to have is gone.

share|improve this question

migrated from Nov 4 '11 at 4:30

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

can you provide more information. How are you accessing this. Via cmd on terminal, php code, etc... May I recommend xampp, this way you can connect to your Database via a graphical user interface download xammp access phpmyadmin gui – Joubin Nov 3 '11 at 17:46
I am connecting using mysql via terminal on a mac running mac os x 10.7 lion. I also tried using SequalPro but get the same error. I am using it with a java program. – user972276 Nov 3 '11 at 19:02

Here is how I access MySQL from my Linux server which in the grand scheme of things should be no different than doing it from OS X

From Command Line, I have OS X at home and I have setup my root access so I would SU to do this. On my Linux server I use SUDO
mysql -u"user"(I would use the root user) -p

then from there run the show database command
mysql> show databases;
Then chose the database you want to use
mysql> use "databasename";

Then go from there.

Hope this helps.

share|improve this answer

Your Answer


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