local wordpress multisite not working on AWS development server “error establishing database connection”

there are several reasons why you can get this type of error,

  • invalid credentials: this you said you have checked, so likely not the reason.
  • corrupt WP files: when moving server, it is possible that the files copied (zip archived) were somewhat corrupted. this would cause can such an error.
  • corrupted DB: again, the DB could have some issues with its installation. This may not be obvious when you are able to view your tables using a tool such as PhpMyAdmin, but it may still be there are some issues with it.

and of course your DB server could be down, but if you are able to access it using phpmyadmin then that ain’t the case.

How to nail it down?

  1. I would first make a new installation of WP, setup it up as a multisite in the sub-folder. Get it to work by default. This rules out corrupted files.
  2. copy all your plugins across and activate them, this will ensure the files are not corrupt.
  3. create a new DB from your localhost copy, change the domain names in the DB (I use InterconnectIt’s excellent Search & Replace tool.) Check the following tables have been properly changed (wp_site, wp_options (look at siteurl and home key values), and wp_blogs).
  4. and finally point your wp-config file to this new DB.

Hopefully it should all work, else, the issue is with the DB being corrupt, so you’ll need to re-export it again and repeat step 3.