Migrating MySQL database to another server, running into issues

Nextcloud version: 19.0.5
Operating system and version: Running in Synology Docker => https://hub.docker.com/r/linuxserver/nextcloud/

First of all, Nextcloud is running perfectly fine, I’m trying to migrate the current database server to another. What have I done so far:

  1. copy the database from one to another server
  2. create the user account and give appopriate rights (copied from the source database)
  3. changed the config.php to point to the new server (‘dbhost’ reference)
  4. restarted the Docker container

All nextcloud gives me now is an internal server error… can’t seem to find anything related to this issue when googling.

As MySQL clients I’ve been using DBeaver and HeidiSQL, I have tried if I can login with my newly created user (called nextcloud) on the new database server and if I can see the nextcloud database. This is definitely the case.

Unsure what else I can try now, any ideas? Is there an entry I’m forgetting here, which I am supposed to change besides the one I did change in the config.php?

Many thanks in advance.

Sorry, but without any information from the Nextcloud log file it won’t be possible to help you with this issue.

maybe you should check if you can connect from inside the docker to the database on command line.
i guess with DBeaver/HeidiSQL you connected from outside your docker (wich could be different).

but i agree with @j-ed, can you lock at your nextcloud log file in your data directory for errors?

I could only find error logs in the php and nginx folders, but those were not very helpful. Should I be looking at some other log? Unfortunately I can’t access the log within Nextcloud itself since it won’t start…

find error logs in the php and nginx folders, but those were not very helpful.

why are they not helpful? do you get new ones when you try to access the nextcloud?
you don´t need access to nextcloud to see the log, look at a “nextcloud.log” file inside your “data” directory (the folder where the user-files are)

@kinimodmeyer: well, I’ve been looking at the wrong location apparently, my apologies! I couldn’t find the nextcloud.log file before. Okay, so what I did, stopped the container, changed the config file to point to the new database server again, started the container. The nextcloud.log file hasn’t got a single new entry unfortunately. So no logs were written at all.

Anything else I can look at?

really hard to help i can only guess.

when you not even get logs then it could be that you have the wrong permission on the files (you changed confiig.php right?) and he is not able to open or write something.

I have been changing that file a lot, when I change it back to how it was (old server), nextcloud works fine again. So it seems that’s not the issue.

However, I stopped the container now, cleared it. Deleted all the configuration files and let it redownload everything as if it was a new install.

The new database server is on 192.168.1.12:3306, the old one is on 192.168.1.3:3307.

When I want to finish the new install, it gives me this error message:

Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1129] Host ‘192.168.1.3’ is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’

Doesn’t make any sense, why it would want to connect to the 192.168.1.3 server… it IS the host of the nextcloud container, but I don’t want it to be the database server anymore. Not sure how it gets there now, when I am not configuring it to be the database server anymore. This is getting really frustrating now :frowning:

EDIT: okay, after performing the mysqladmin flush-hosts, it now gives me:

Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

EDIT2: now it gives me:

Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user ‘nextcloud’@‘192.168.1.3’ (using password: YES)

And again pointing to the 192.168.1.3 server, which is the wrong one…