-
-
Notifications
You must be signed in to change notification settings - Fork 96
bin/console fails with SQLSTATE[HY000] [2002] #14
Comments
@betonme Can I see your docker-compose file please? It looks like the console can't find the sqlite file but I need to see the environment. |
I'm using MySQL and used the sample Docker-Compose file unchanged |
Same problem with |
I'm facing the same issue when trying to create a user. What I do: > docker run --rm -ti -p 8001:8001 --name kimai2 -v ${HOME}/.config/kimai/:/opt/kimai/var/data/ -e SQL_DATABASE=/opt/kimai/var/data/kimai.sqlite kimai/kimai2:prod
> docker exec kimai2 bin/console kimai:create-user admin admin@example.com ROLE_SUPER_ADMIN admin
[ERROR] Failed to create user: admin
[ERROR] Reason: An exception occurred in driver: SQLSTATE[HY000] [2002] No such
file or directory The > ls -l ~/.config/kimai
-rw-rw-r-- 1 www-data www-data 106496 Mär 6 14:27 kimai.sqlite I'm using your docker image from dockerhub, no custom compose file or similar. |
No problem. For the completeness, I'm using a separate container running MySQL. The main problem is, I can't import the data of a kimai v1 MySQL database. |
Hi @betonme , @orzechow and @tobybatch
I'm having the same issues with trying to import the kimai v1 database wich throws the error
❓ Is there something I can do to help fix this? 🤔 |
Some more context from my second try: I emptied the table kimai_users so the table just had the structure but no data anymore and this is the output of the still failing import:
After this row there are endless errors like this for every customer and the log goes on the same with projects:
and finally:
Then there's something strange happening with activities, it displays 8 times the well known error and once a warning about an empty name and in the end it shows that it created 9 activities. However if i take a look at the activities table after the import the activities table is empty and nothing has been imported:
After this, importing the timesheets fails completely (as it does with the users on the first try):
|
Ignore the "Imported activities: 9" - this is a false-positive in the importer, which obviously doesn't fail gracefully when the database is not available. You could try to prepend the DATABASE_URL to the import command and see what happens, so something like: DATABASE_URL=sqlite:///%kernel.project_dir%/var/data/kimai2.sqlite bin/console kimai:import-v1 ... Can you show me the contents of your |
Hi @kevinpapst I'm using a sql server database and not sqlite for saving data. I've checked that my database is connected correctly by adding an user through the webinterface and adding some test data (customer, project and activity). Timetracking works this way and the entries are being saved in the database. 🏁 I don't think that I'm having issues with writing to the database, so I don't understand why I should try to prepend the DATABASE_URL to the import command. 🤔 I'm running the docker build and don't have an .env file, but these are the env variables of the running tobybatch/kimai2 container:
|
What about simply giving it a try? Well, okay here it goes: So: prepend it to the command to set it temporarily and see what happens. |
@tobybatch your hint with the sqlite url made me make some progress: I've set up a new container with the default settings (sqlite as data storage) and tried to do the same import with the same command which was failing before: 🎉 THIS WORKS! The data is being imported. So i think it has something to do with the database where the data should be saved to. ❓ What would be the correct DATABASE_URL for a mysql server database? 🤔 (or let me search for it on the internet and i'll edit this post later... i've got to go now, so i won't check this until tomorrow or later.) |
I think there may be an issue about where kimai is picking up the DB URL from when it runs from the CLI rather than through apache. I will investigate. I've just finished a sprint at work so may have some time next week. |
🎉 Thanks to @kevinpapst , my issue is resolved 🎉 Steps to reproduce: 1️⃣ Set a proper DATABASE_URL as env variable as suggested by @kevinpapst . An example for a proper database url is 2️⃣ Make sure all users have an unique email address in the importing database table 3️⃣ Make sure the table |
Okay, I could also fix my problem. I always tested with no First of all I've mixed up This docker run --rm -ti -p 8001:8001 --name kimai2 -v ${HOME}/.config/kimai/:/opt/kimai/var/data/ -e DATABASE_URL=sqlite:///%kernel.project_dir%/var/data/kimai.sqlite kimai/kimai2:prod
docker exec kimai2 bin/console kimai:create-user admin admin@example.com ROLE_SUPER_ADMIN admin works now (thus also the default without Probably I also didn't provide proper user rights for www-data on my host machines target folder 🙄 Confusingly docker run --rm -ti -p 8001:8001 --name kimai2 -v ${HOME}/.config/kimai/:/opt/kimai/var/data/ -e DATABASE_URL=sqlite:///opt/kimai/var/data/kimai.sqlite kimai/kimai2:prod
docker exec kimai2 bin/console kimai:create-user admin admin@example.com ROLE_SUPER_ADMIN admin opens/creates the database, but still fails in adding the admin user, even though this should be the correct path... |
@rschaerer @orzechow @betonme Again sorry for delay. The issue here is how the prod image picks up it's DB url. It is built in the startup script and that is fine for the web instance but when you shell in to use the console it is not set. I have switched round the way the databse url is built. The DATABASE_URL must be passed into the container at start time. https://github.com/tobybatch/kimai2/blob/master/prod/README.md#runtime-args I think this will fix the problem. |
Hi, that's fixed my issue. Thanks |
I'm using Docker version 18.06.1-ce, build e68fc7a on a Debian system.
First I've adapted Your Docker-Compose file:
https://github.com/tobybatch/kimai2/blob/master/docker-compose.yml
After running into problems, I used it unchanged with the same result.
The web interface is working fine.
First test to create a user was fine.
Then using the console to import my Kimai V1 data, I tested to create a user.
But it fails with:
[ERROR] Reason: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory
Also I can not import the data, same error.
Any ideas? Thanks
The text was updated successfully, but these errors were encountered: