A
A
Anton Isaev2017-01-23 10:57:10
MySQL
Anton Isaev, 2017-01-23 10:57:10

Why does not want to connect to the MySQL database?

Please help me with connection problem. There is a VPS, a MySQL database is deployed on it, a user userdevel is created with a password of 0000 and full rights to the dbdevel database. When connecting to the database via the console, the connection is successful:
mysql -u userdevel -p
On the same server, the Apache + Passenger bundle is deployed, a site has been created in development mode for online debugging of the deployed application:

# /etc/apache2/sites-available/devel-website.conf
<VirtualHost *:80> 
...
    PassengerAppEnv development 
...
</VirtualHost>

The Ruby on Rails project was copied to the folder, logins and passwords for connection are specified in the config/database.yml file:
default: &default
  adapter: mysql2
  pool: 5
  timeout: 5000
  host: 127.0.0.1
  password: 0000
  encoding: utf8

development:
  <<: *default
  database: userdevel
  username: dbdevel
(I’ll say right away: replacing 127.0.0.1 with localhost in the host line did not help)
But when I try to open the Action Controller site, I get an error:
Access denied for user 'userdevel'@'localhost' (using password: YES)

I repeat, this user (login-password combination) connects to mysql through the console without any problems.
Here is the table of users from the database:
mysql> select user,host from mysql.user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| userdevel        | %         |
| debian-sys-maint | localhost |
| mysql.sys        | localhost |
| root             | localhost |
| userdevel        | localhost |
| usertest         | localhost |
| userwork         | localhost |
+------------------+-----------+
7 rows in set (0.00 sec)

What did I do wrong? Tell me please.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
A person from Kazakhstan, 2017-01-23
@antooninc

and for "userdevel" the rights are all given?

S
Saboteur, 2017-01-23
@saboteur_kiev

In the database, [email protected] and [email protected] are different users. You are explicitly told that
"Access denied for user 'userdevel'@'localhost' (using password: YES)"
That is, either there is no such user, or the password is different. Check the list of users and add rights to the corresponding user.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question