D
D
DieZz2016-01-11 19:56:26
MySQL
DieZz, 2016-01-11 19:56:26

How to fix database connection error after migrating Redmine?

Transferred redmine from one server to another. Launched application on Debian 8, Apache 2.4 + mod_passanger. The database does not live on another server. Here is database.yml

production:
  adapter: mysql2
  database: dbname
  host: 192.168.x.x
  username: login
  password: "password"
  encoding: utf8

Redmine even works, but when you try to log in, it gives a status of 500. Here is the error code:
Mysql2::Error (Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)):
  app/models/user.rb:264:in `check_password?'
  app/models/user.rb:170:in `try_to_login'
  app/controllers/account_controller.rb:183:in `password_authentication'
  app/controllers/account_controller.rb:178:in `authenticate_user'
  app/controllers/account_controller.rb:32:in `login'

I’m not strong at all in ruby, help me understand where the application is trying to break into the database on the local host? Mysqlserver is not installed on the server on which I am running the redmine, only mysqlclient is installed.
Apache config:
<VirtualHost *:80>
    DocumentRoot /var/www/redmine/public
    ServerName redmine
    ErrorLog /var/www/redmine/error_log
    CustomLog /var/www/redmine/access_log common
    <Directory /var/www/redmine/public>
        RailsEnv production
        Options FollowSymLinks
        RailsBaseURI /
        PassengerResolveSymlinksinDocumentRoot on..
        AllowOverride All
    </Directory>

</VirtualHost>

upd.: the problem is solved - external authorization was configured and there was just an attempt to access the database on the localhost.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan GiBSON, 2016-01-11
@gibson_dev

It's just that the app is launched not in production mode, but in some other way.
Try to add RailsEnv production
my config in VirtualHost'a config like this

<VirtualHost *:80>
ServerAdmin [email protected]
Servername example.com
DocumentRoot /var/www/html/
PassengerUser redmine
        <Location /redmine>
                RailsEnv production
                RackBaseURI /redmine
                Options -MultiViews
        </Location>
</VirtualHost>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question