Unknown database

Unknown database

ehardingeharding Posts: 15Questions: 7Answers: 0

I started getting this when I moved my app to a multi-server environment. it appears to be ignoring the $host value and using localhost.

"An error occurred while connecting to the database 'aps'. The error reported by the server was: SQLSTATE[42000] [1049] Unknown database 'aps'"

Answers

  • trevoctrevoc Posts: 14Questions: 3Answers: 1

    maybe posting some code will help,

    How do you know it's using localhost?

    Sounds more like a permissions problem on the dbase server (explain below)

    When running multi-server environment, your dbase server most likely will not accept any requests from your requesting server (with the .php files) without being whitelisted.

    e.g. from my google cloud sql server, I need to whitelist the IP address of my web server for it to accept incoming requests at all, even though the mysql user is user@% or (anyhost), the server or instance itself still needs to be whitelisted.

    to add to the confusion, if you are on a shared web server, the IP address making the requests over port 3306 to the sql server may be originating from a different IP address than your hosting providing shows as your web IP.

    Hope that helps, I'm aslo assuming you are using server-side processing??

    Again, vague question without some more information.

    what is your multi-server setup?

    are you making simple mysql queries and building a table and using default DT from the DOM, or using server side processing?

  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin

    What server-side script are you use? How is the connection being defined?

    Allan

This discussion has been closed.