Network data server 3d cloud computing concept realistic vector illustration
Connecting WordPress site with a remote database (Database on another server) is a simple task. I checked huge websites and videos for connecting the WordPress website with the remote database but unable to find a proper solution. But after huge research and development. I found the solution for connecting the database. It is just a few steps to follow and the database will connect with your WordPress.
Steps are :
1 . check your remote database is working fine or not.
2. If you are using vps server then try to ping the database server IP. (its shows you the server can connect your database ) This step is important.
3. if you are installing fresh WordPress then you enter the Database name, database user and database password and in the last enter database server ip.
If you are connecting existing WordPress sites, then you have to change in the wp-cofig.php file and enter these details Database name, database user and database password and in the last enter database server IP.
4. After that check your site on the web browser.
If you still facing the issue then check properly the details that you entered.
for the VPS server you still facing issues related to that then follow a few more steps.
Script/code
<?php $conn=mysqli_connect(“databaseIP”,”database_user”,”database_password”,”databasename”); if(!$conn){ echo “not connected”; }else{ echo “Connected”; } ?> |
Save this code by name.php and upload it on server after that check if status is not connected then may be in your wordpress site having some code issue or database details are not correct and check firewall also.
One more thing you can check on VPS that code is connected or not.
[root@ns110 ~]# php /path of Scripit/code / name.php
you will get a response.
if the response is connected but on the web browser not connected.
Then type this command after that you will able to connect the database from the VPS server.
sudo setsebool -P httpd_can_network_connect 1 |
you can check in you php logs or apache logs ( /var/logs/httpd/error_log).
You will find the error which stoping the connectivity.
If you still facing issues just comment down I will help you.
1 Comment
https://thesiswritingtob.com/ – thesis support doctoral thesis writing help thesis thesis writing services