I have a website hosting on www.host1free.com. Earlier I had connected to MySQL database of the host.
Now I am having my own VPS which is accessed by ip address 5.231.36.181. I have also installed phpmyadmin. All works fine within the server.
Now I want to connect my website database to the MySQL server on 5.231.36.181.
The database on the server is accessed by 5.231.36.181/phpmyadmin and the database on host is accessed by sql12.1freehosting.com/phpmyadmin
How to connect the database to my VPS phpmyadmin ?
whatever the details you are using for logging in to your phpmyadmin use the same usename and password for connecting to database
secondly host can be localhost or your VPS IP Address
The rectangle marked in red contains your IP ,
connecting to mysql database
// Define database connection constants
define('DB_HOST', 'your IP');
define('DB_USER', 'Your DB USER');
define('DB_PASSWORD', 'db user Password');
define('DB_NAME', 'your dbname');
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME)
or die('cannot connect to MYSQL');
if you are confused you can create a new database user assign the database to the particular user and can use the details to connect to your DB Cheers
You connect your website to MySql database, not to PhpMyAdmin. Enter Host as localhost
, username and password. If localhost is not working, try entering IP of database. There must be statet somewhere what params to use to connect to database
Use Your Mysql Details and connect to your dataBase like this:
mysqli_connect('5.231.36.181',username,password,dbname);