Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[error] failed to initialize database, got error Error 1045: Access denied for user 'photoview' #870

Closed
grannymaster opened this issue Aug 5, 2023 · 9 comments · Fixed by #863
Labels
bug Something isn't working docker Related to deployment with Docker good first issue Good for newcomers
Projects

Comments

@grannymaster
Copy link

Describe the bug
When trying to start the container, I get this error:
[error] failed to initialize database, got error Error 1045: Access denied for user 'photoview'@'192.168.128.3' (using password: YES)

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://github.com/photoview/photoview#getting-started---setup-with-docker
  2. Copied docker-compose.example.yml to my docker host
  3. Changed port from 8000 to 22273
  4. Changed photo location to /media/photos/
  5. The error appears after running docker compose up -d

Expected behavior
For the container to launch

Your environment:
Ubuntu (22.04.2 LTS (Jammy Jellyfish)) with Docker (Docker version 24.0.4, build 3713ee1) and Docker Compose installed (Docker Compose version v2.19.1)

  • Are you using Docker? yes
  • Database mariadb 10.5
  • Browser Firefox
  • Version 2.0.0

Additional context
My docker-compose.yaml file:
https://pastebin.com/mrsy0aYB

Logs:
https://pastebin.com/g38EUq9i

What am I doing wrong?

@grannymaster grannymaster added the bug Something isn't working label Aug 5, 2023
@kkovaletp
Copy link
Contributor

Try the setup from my PR #863 - I fixed several issues there. It may help you as well.
If not, please attach separate logs from the DB and PhotoView containers. You could get them by the following commands:
docker logs photoview
docker logs photoview-mariadb

@grannymaster
Copy link
Author

Seems to be working with those settings! Thank you! I need to do some more testing tomorrow.

One quick question, what data does this section in .env refer to? Does it refer to Photoview settings etc. or photos?

## This is where the Photoview data will be backed up
HOST_PHOTOVIW_BACKUP=/media/Backup/PhotoView

@kkovaletp
Copy link
Contributor

One quick question, what data does this section in .env refer to? Does it refer to Photoview settings etc. or photos?

## This is where the Photoview data will be backed up
HOST_PHOTOVIW_BACKUP=/media/Backup/PhotoView

It refers to the Makefile's backup function: if you'll run make backup, this is where the backup will be created

@grannymaster
Copy link
Author

grannymaster commented Aug 6, 2023

Aah, thank you for explaining!

After some testing, everything seems to be working just fine, except some of the photos just appear as white rectangles.
https://i.imgur.com/mxz4dW6.png

This only happens for the latest 50-100 photos, if I scroll more then everything seems to be fine.

I also get this error message when clicking on any of those white rectangles:
could not get media by media_id and user_id from database: record not found

Quick EDIT: Doesn't seem to be browser or bad cookies related. I tried Firefox and Chome, both freshly installed in Windows Sandbox.

@kkovaletp
Copy link
Contributor

some of the photos just appear as white rectangles. https://i.imgur.com/mxz4dW6.png

This only happens for the latest 50-100 photos, if I scroll more then everything seems to be fine.

I also get this error message when clicking on any of those white rectangles: could not get media by media_id and user_id from database: record not found

The error message says that these photos are not scanned or the data is partly corrupted in the DB.
Make sure that PhotoView, MariaDB, and the media sources location are up and running, and no active job in Photoview is running.
Then run the job manually from the Settings page and wait until it is completed successfully. As most of your photos are already in the DB and have not changed since that, the job should finish quickly.
Once it is done - check those photos in the Photoview again.

@grannymaster
Copy link
Author

I've done the scan multiple times, I even enabled the periodical scan which has occurred once. I'll try setting up the container again.

@kkovaletp
Copy link
Contributor

Are you sure that the access to the media sources' location is stable?
Are you sure that those images are not corrupted in the media sources' location? You could verify them by installing ImageMagick and running magick identify -regard-warnings -verbose <path to the image>

Please attach the full log from docker logs photoview, containing the scan job from start to finish and the access time to those images after that job - do you see something unusual there?

If everything is fine but the issue is still there, most probably your DB is corrupted. Make a backup and recreate it from scratch, make sure that everything is stable, then run the scanning job and don't interrupt it until finished.

@grannymaster
Copy link
Author

grannymaster commented Aug 7, 2023

The error occurs with photos from 2023, I went through all of the just from Windows Explorer, and everything works fine.

I went ahead and deleted the "storage" and "database" folders and spun up the container again. The same problem, here is the logs, I'm not knowledgeable enough to see if something is wrong.
https://drive.google.com/file/d/1krRlmPrpogsD6EtL0CeZZ4fMEfBVS_hm/view?usp=drive_link

I also made a Photoprism container which had no problems displaying the same images.

@kkovaletp
Copy link
Contributor

Did you run the ImageMagick command for images, which cause an issue? Was there some error or warning?

I see the only error 2023/08/07 15:47:56 File is not a supported media /photos/2023/photos/IMG_3470.yml so far... Which is expected, as this is not an image.
Could you please share the paths of problematic images in the same format, so I could search for their processing messages in the log?
If they are there and no errors are reported, you need to inspect the data, stored in the DB for those images. Alternatively, we need some help from the Photoview developer here.

Photoprism has image auto-fix functionality during the scanning job run, which is why you don't see this problem there.

Anyway, all this thread about missing \ corrupted images is not related to the original topic - it will be better to submit another issue here, move this thread there and continue the discussion: this way we won't mix things and keep the discussion focused on the reported problem

@kkovaletp kkovaletp linked a pull request Apr 29, 2024 that will close this issue
@kkovaletp kkovaletp added good first issue Good for newcomers docker Related to deployment with Docker labels Apr 29, 2024
@kkovaletp kkovaletp added this to To do in Roadmap via automation Apr 29, 2024
Roadmap automation moved this from To do to Done May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docker Related to deployment with Docker good first issue Good for newcomers
Projects
Development

Successfully merging a pull request may close this issue.

2 participants