Error establishing a database connection, Got error 'Primary script unknown'

Keywords: WordPress Multisite - AWS - How to - Services (Apache, MariaDB, MySQL…)

I’ve issue ‘Error establishing a database connection’. Database using RDS-MySQL on AWS, the result is connection successfully

To check this I’ve created simple php script and able to connect to DB

<?php $link = mysqli_connect('', 'userdb', 'pass'); if (!$link) { die('Could not connect: ' . mysqli_error()); } echo 'Connected successfully'; mysqli_close($link); ?>

also having error on apache error_log
[proxy_fcgi:error] [pid 7284:tid 140xx] [client ip:port] AH01071: Got error ‘Primary script unknown’

Appreciate can help to solved this issue.

Hi @ex-ariefhilman001,

Can you check this guide?


Hi @michiel

From :

  1. command line I’m able to login.
  2. browser accessing https://domain/test-con-db.php also able to show the result

Also, I’ve send bnsupport-tool result and here the code 0e419693-0da4-f885-7f2f-6518953ed9e0.


Hi @ex-ariefhilman001,

Can you check this guide too for migrating to RDS?

Especially this section:


Hi @michiel

I’ve follow the steps, event telnet result is success but still error still occurs - we are using amazon lightsail for database.


Hello @ex-ariefhilman001,

I’m not sure I understand the issue correctly; the problem is connecting to the RDS database using WordPress or connecting from the LAMP instance? Have you configured the database parameters in WP config file wp-config.php?

Francisco de Paz

Hi @fdepaz

  1. EC2 using image : LAMP_PHP_7-1-20201206
  2. RDS using MySQL on lightsail
    —> the parameters DB on wp-config.php already configured. Manual test connection using :
    a. mysql -u -h -p —> success
    b. telnet endpointdb 3306 —> success
    c. create simple php script to connect db —> success
    d. error message while accessing the url from public : Error establishing a database
    e. if accessing https://url/wp-admin the error message :
    “If your site does not display, please contact the owner of this network. If you are the
    owner of this network please check that MySQL is running properly and all tables are
    error free.
    Could not find site . Searched for table <xx_blogs> in database
    . Is that right?”


Jo @ex-ariefhilman001,

I think the best approach here is start with a WordPress single instance, migrate it to RDS and then convert it to multisite.

This guide shows how to migrate to RDS from a single WP site:

And then this guide shows how you can convert it to multisite:


Hi @michiel,

We will work on this. thank you.

1 Like