3

I'm trying to install a PHP-based tool which connects to a MySQL database, hosted on Ubuntu. I can log into the MySQL database from the command line, but running the app results in this error:

Access denied for user '[user]'@'localhost' (using password: YES)

What I've done: Using guidance from this discussion, here are some troubleshooting steps I've taken.

  • Trying to connect to MySQL via Telnet results in this garbled nonsense:

    $ telnet 127.0.0.1 3306
    Trying 127.0.0.1...
    Connected to 127.0.0.1.
    Escape character is '^]'.
    A
    5.1.41-3ubuntu12.10XIs(ja&7FyO`r>zpDAY{Connection closed by foreign host.
    
  • My /etc/hosts.deny file is empty. I've added the following lines to my /etc/hosts.allow file:

    mysqld: ALL : ALLOW mysqld-max: ALL : ALLOW

  • Although the bind-address in my /etc/mysql/my.cnf file was set to 127.0.0.1, I commented it out to no avail.

  • Disable the firewall

  • Flush privileges

It should be noted that I restarted MySQL after each of these steps using the following command:

mysqladmin -u [user] -p shutdown
mysqld_safe &

What am I missing?

2 Answers 2

2

If mysql admin works does the client program work?

If the client program works one possibility is the mysql client library is out of date and needs to be updated. (I'm more familiar with RedHat but it's probably something like sudo apt-get update php-mysql .. not 100% sure on that package name)

Also make sure that you are using the exact name you set the user up with. If you setup the user as user@localhost it might not work to use [email protected]

hope that helps

1
  • The password was incorrect in the stored config file. An embarrassing mistake but worth posting in case it helps someone else with the same issue.
    – Dan
    Mar 18, 2011 at 17:00
2

Try this

mysql >GRANT ALL ON [database name].* TO [user]@'127.0.0.1' IDENTIFIED BY '[PASSWORD]';

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .