0
root@DS-S007:/etc/dspam# mysql -u root –ppassword
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
root@DS-S007:/etc/dspam# 

I clearly specified a password. Why does is still say NO?

I have also tried the variation mysql -u root –p. Which usually works for me.

("password" is not what I'm actually typing.)

11
  • Try using only -u root -p ... that is no "password" after -p.
    – ojs
    Feb 18, 2015 at 0:28
  • I've tried that as well. It didn't work. Any other ideas?
    – Dobler
    Feb 18, 2015 at 0:37
  • Do you get the same error? Can you log in as a different user?
    – ojs
    Feb 18, 2015 at 0:38
  • I don't have any others yet. but it always says "NO" regardless of the user name.
    – Dobler
    Feb 18, 2015 at 0:40
  • 1
    Try using the long form of the command and report back. (For example, mysql --host=localhost --user=myname --password=mypass mydb.) Feb 18, 2015 at 4:07

2 Answers 2

1

Have you noticed that you've not put a space between -p and your password? (using password: NO)

Failing that, have you run the MySQL setup scripts? You may want to do that, since you're on Debian it should be:

# mysql_install_db

and running the security script would be

# /usr/bin/mysql_secure_installation

2
  • yes I know there is no space. I have tried it both ways. Yes I have run and rerun the setup scripts. Any other ideas?
    – Dobler
    Feb 18, 2015 at 12:14
  • Personally, I would try purging & reinstalling mysql (# apt-get purge mysql-server) and running the setup scripts again. Since your connection is definitely making to the server, the only thing that could be wrong is bad credentials.
    – user270795
    Feb 22, 2015 at 13:10
0

HopelessN00b suggested i try the long form of the command. This worked correctly. What a weird issue!

mysql --host=localhost --user=myname --password=mypass mydb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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