Migrating from one database server to another

Greetings all. I currently have a nice tidy installation and I am attempting to migrate from Aurora 5.6 (via AWS RDS) to a stand alone MariaDB server (v5.5). Nothing else is changing. I took a swing at simply exporting the data from Aurora to the new MariaDB server. The export/import process went perfectly smoothe. However when I updated my config.php file with the new host name, it started throwing HTTP 500 errors and the nginx error log showed this:

2019/01/02 21:58:42 [error] 11900#11900: *13 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user 'nextclouddbadmin'@'10.2.1.238' (using password: YES) in /var/www/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /var/www/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.ph...PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user 'nextclouddbadmin'@'10.2.1.238' (using password: YES) in /var/www/nextcloud/lib/private/DB/Connection.php:64

I tried restarting php-fpm and nginx but it continued to throw the same errors. The error is quite obvious. The ip address 10.2.1.238 is the OLD server. So it appears to be cached or something somewhere. But I can’t figure out how to flush this.

Any thoughts?

Nextcloud version 15.0.0.10:
Operating system and version CentOS 7:
Apache or nginx version nginx 1.14.2:
PHP version 7.3.0 with Zend OPcache:

What happens if you do a DNS lookup on the old and new domain names? Do they resolve to different IPs? Have you tried putting the IP in config.php?

Yeah the config only has IP addresses:

$CONFIG = array (
  'instanceid' => 'ocf18ujo5gje',
  'passwordsalt' => '9n2YSdqGrJR5rltFRb+ZcAStP13Gsy',
  'secret' => '****',
  'trusted_domains' =>
  array (
    0 => '*',
  ),
  'datadirectory' => '/data/nextcloud_data',
  'dbtype' => 'mysql',
  'version' => '15.0.0.10',
  'overwrite.cli.url' => 'http://nextcloud.****.com',
  'dbname' => 'nextclouddb',
  'dbhost' => '10.2.2.99',
  'dbport' => '3306',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloudadmin',
  'dbpassword' => '****',
  'installed' => true,
);

Did you also grant the oc user access to the imported DB? Unless you also imported the mysql DB, which might not be the best idea, the db user can’t connect to the DB.