juanluisbaptiste / docker-otrs

The unofficial Znuny/OTRS Ticketing System docker image
https://www.juanbaptiste.tech/category/otrs
GNU Lesser General Public License v3.0
173 stars 101 forks source link

Cant connect with DB #44

Closed rafalix1337 closed 5 years ago

rafalix1337 commented 5 years ago

Hello!

I'm trying to run a stack from docker-compose.yml with default .env and I can't connect with MySQL:
otrs.Daemon.pl: DBI connect('database=otrs;host=127.0.0.1;','otrs',...) failed: Can't connect to MySQL server on '127.0.0.1' (111) at /opt/otrs/Kernel/System/DB.pm line 204.

Inside container with OTRS deamon:

Can't connect:

 mysql -u root -p -h localhost
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Can connect:

[root@cd2480e8d50c Kernel]# mysql -u root -p -h mariadb
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
....

DB otrs doesn't exist:

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

I suppose data in Config.pm are too wrong - Should be data with our variables set in .env file :

[root@cd2480e8d50c Kernel]# pwd
/opt/otrs/Kernel

[root@cd2480e8d50c Kernel]# cat Config.pm | grep -A 14 "The database host"
    # The database host
    $Self->{DatabaseHost} = '127.0.0.1';

    # The database name
    $Self->{Database} = 'otrs';

    # The database user
    $Self->{DatabaseUser} = 'otrs';

    # The password of database user. You also can use bin/otrs.Console.pl Maint::Database::PasswordCrypt
    # for crypted passwords
    $Self->{DatabasePw} = 'some-pass'; 

Please check it.

juanluisbaptiste commented 5 years ago

Whats the container output ?

rafalix1337 commented 5 years ago

Output from docker-compose up : https://i.postimg.cc/qrDM3hLx/otrs.png

juanluisbaptiste commented 5 years ago

The output isn complete on the screenshot, please post full text output here, also the docker-compose.yml file

rafalix1337 commented 5 years ago

docker-compose up: docker-compose.yml .env

juanluisbaptiste commented 5 years ago

You are not using the stock .env file, you changed OTRS_INSTALL=yes and the default is no. Setting it to yes will ignore all variables as the installer will be run instead.

I haven't tested OTRS_INSTALL=yes in a long time,as the installer is of little use when you can start a ready to use OTRS install by default. It is there more for testing purposes.

rafalix1337 commented 5 years ago

Now works, thanks :+1: