WordPress is a free and open-source blogging tool and a content management system(CMS) based on PHP and MySQL, Where MySQL is a database system used on the WordPress. When we are developing the WordPress website on local server we need to create a new database on our local server to install WordPress or we can also connect a WordPress with remote database.
Here are the steps to Connect WordPress with Remote Database (MySQL) :
Server & Database Details :
We need the following details from server/cPanel/hosting provider,
- Database Name
- Database Username
- Database Password
Allow Remote Server to Access Our Database :
We need to specific domain name to allow visitors to connect to our MySQL databases by adding IP address/Access Host from which a application is going to run. If you are going to use the database from our local system we need to add our system IP Address or If we need to use on website/server we need to add IP Address of the server.
Connect WordPress with Remote Database :
After we added our Host(For Example : 188.8.131.52). Now our database is ready to connect with the WordPress which is on the Host/IP Address(184.108.40.206) then we need to add our database details and hostname on wp-config.php
/** The name of the database for WordPress */ define('DB_NAME', 'database_name_here'); /** MySQL database username */ define('DB_USER', 'username_here'); /** MySQL database password */ define('DB_PASSWORD', 'password_here'); /** MySQL hostname */ define('DB_HOST', 'localhost');
Now, Our WordPress will successfully connected to the remote database. If you have any questions/feedback, Please leave your message on below comment box.
Thank You !!