I'm getting the error "SQLSTATE[28000] [1045] Access denied for user 'user'@'localhost' (using password: YES)"

My "main.php" looks like this:


        'db'=>array(

            'connectionString'=>'mysql:mysql-server;dbname=db',

            'emulatePrepare'=>true,

            'username'=>'user',

            'password'=>'password',

            'charset'=>'utf8',

        ),

And when I try to connect via console I’m getting this:


lealcy@lealcy:/var/www$ sudo su www-data

$ mysql -hmysql-server -uuser -ppassword        

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 266

Server version: 5.1.41-3ubuntu12.10 (Ubuntu)


Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and redistribute it under the GPL v2 license


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> use db;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A


Database changed

mysql> 



Which probably means that there is nothing wrong with the MySQL server itself, the www-data (Apache) user, or the MySQL server user. What could I’m doing wrong?

I have another project on my machine which connect to a local MySQL instance fine with similar setup.

I’ve got what I did wrong: the connection string was missing the “host=” part:


'connectionString'=>'mysql:host=mysql-server;dbname=db',