0

I have upgraded my openSUSE to the latest 13.1. During the upgrade, mysql was upgraded from 5.5 to 5.6. I managed to upgrade the server (mysql_upgrade), after deleting the /etc/my.cnf

After the upgrade, my PHP based web apps are not connected to the server, with the following error: Access denied for user ''@'localhost' (using password: YES)

The relevant entry in my PHP file (which is the same for the last 2 years!) is:

(mysqli_real_connect($GLOBALS["___mysqli_ston"], "localhost",  "<USERNAME>",  "<password>", NULL, 3306, NULL,  196608))) ? $GLOBALS["___mysqli_ston"] : FALSE);

What I have found is:

  • PHP/mysql connector login to the server
  • PHP/mysqli connector fails to connect to the server
  • mysql -u USERNAME -p connects to the server
  • mysql -u USERNAME@localhost FAILS to connect to the server.
  • mysql listens at the standard 3306 port.

The netstat confirms it:

netstat -anpt | grep -i mysql
tcp        0      0 :::3306                 :::*                    LISTEN      8549/mysqld    

The privileges have not changed after the upgrade! The relevant entries in the user table of mysql DB are:

SELECT `Host` , `User` , `max_user_connections` , `password_expired`
-> FROM `user`
-> WHERE `User`='<username>'

+-----------+--------------+----------------------+------------------+
| Host      | User         | max_user_connections | password_expired |
+-----------+--------------+----------------------+------------------+
| localhost | <username>   |                    0 | N                |
+-----------+--------------+----------------------+------------------+

Obviously, the @localhost is the problem, but why?

-1

It looks like you are trying to use username as username@localhost. This looks to be incorrect by default mysql client will try to connect to localhost unless specified with -h.

So it should be -u USER and not -u USER@LOCALHOST

  • Did you read all information? The problem is not what I use, but how the mysqli tries to connect to the mysql server. – Peter Nov 25 '13 at 13:19

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.