Doaa A.
Doaa A.

Reputation: 129

How to reference mysql config file in php

I have been searching the web and all over stackoverflow, but yet couldn't find my answers.

My client has created an online mysql database with phpmyadmin installed. I use a url like (http://domainName.com/folder1/index.php) to access the database tables and settings.

Now my problems are:

  1. It's mentioned in the documentation of phpmyadmin that I should manually create a folder config in the phpMyAdmin directory. How can I do this exactly when the database is hosted online?
  2. After getting to do number 1, I would want to place the config file in that folder and reference the database's username and password in my application's php files. I'm confused about the url I should include?

Thanks in advance.

Upvotes: 1

Views: 805

Answers (1)

TheFrack
TheFrack

Reputation: 2873

Just do this...

  1. FTP to the PHPMyAdmin directory on the web server. If you need an FTP get FileZilla.
  2. Copy/Rename your local copy of "config.sample.inc.php" to "config.inc.php"
  3. Edit the "config.inc.php" file by finding the line that starts with...

    $cfg['Servers'][$i]['host'] = '';
    

    and change it to have the network address of the database.

    $cfg['Servers'][$i]['host'] = '127.0.0.1';//127.0.0.1 is just localhost IPv4
    
  4. Save and upload the copied/renamed file.

Upvotes: 1

Related Questions