Rectangle 27 0

Rails Passenger & mysql Access denied for user?


*$mysql -u root -h 127.0.0.1
ERROR 1698 (28000): Access denied for user 'root'@'localhost'*
*evelopment: &development
  adapter: mysql2
  database: development
  encoding: utf8
  username: root
  password:
  host: localhost
  socket: /var/run/mysqld/mysqld.sock*
*sudo mysql -u root
use mysql;
update user set plugin='' where User='root';
flush privileges;
exit;*

After adjusting root user with following, issue resolved.

Exact same setup was working on other dev instances but after spending a full day i got the solution.

I faced the exact same issue. while setting up the ror app all the rake commands worked fine. mysql was simply accessible from linux console by simply typing "mysql" and it take to mysql console and database.yml was using root user with empty password.

Then application tries to connect to mysql as "mysql -u root -h localhost" and in my case this command was giving following error.

Note
Rectangle 27 0

Rails Passenger & mysql Access denied for user?


SELECT Host FROM mysql.user WHERE User='myusername';

Check if the sorting rules are not affecting you :

Identity checking is performed using the three user table scope columns (Host, User, and Password). The server accepts the connection only if the Host and User columns in some user table row match the client host name and user name and the client supplies the password specified in that row.

If you can connect using the right username and password from command line but your scripts cannot connect using the same credentials, check the the database mysql, table user for the correct values in the column Host.

The server uses the first row that matches the client host name and user name.

Note