i am new in code igniter, i tried to connect with local db then successfully connected,but while connecting with external db it resulting an error
A PHP Error was encountered
Severity: Warning
Message: mysqli::real_connect(): (HY000/2003): Can't connect to MySQL server on 'xxxxx.gridserver.com' (110)
Filename: mysqli/mysqli_driver.php
Line Number: 202
Backtrace:
File: /var/www/html/restapi/application/libraries/REST_Controller.php
Line: 375
Function: __construct
File: /var/www/html/restapi/application/controllers/Project.php
Line: 26
Function: __construct
File: /var/www/html/restapi/index.php
Line: 292
Function: require_once
i am not familiar with mysql,
i searched more for it, but i have no idea what they speaking about it, is there anything to do for external db connecton
Thank you in advance!
1.Check your application/config/database.php
Enable remote MySQL connection: ERROR 1045 (28000): Access denied for user
and
https://www.youtube.com/watch?v=xXOq9U9fzOo
Check your config->database.php to ensure the $db['default']['hostname'],$db['default']['username'],$db['default']['password'],$db['default']['database'] are set correctly.
Anther possibility is you're trying to connect a MySQL server remotely but the server itself is blocking remote connection. So make sure that you are able to connect your mysql database using the same set of host, username, password through Mysql client software such as "MySQL Workbench"
As stated by Tan See Youu, it's likely that you may have incorrect credentials in the database.php or indeed named remote connection is being blocked by the server. Though in some cases hosts offer tunnles to be used to allow remote connections through a secured connection. You might want to ask your hosting if they have a SSH tunnel that you could use if they do block direct connections.