I have created on php file for establishing connection with database server. In this file, i am using mysql_connect()
function with parameters host, username and password of my database server.
public class DatabaseConnect
{
function __construct()
{
mysql_connect('localhost','username','password') or die('Could not connect to mysql server.');
mysql_select_db('databasename');
}
}
Now in this case, username and password are visible to others.
I found one more way to secure the value i.e. mysql.default_user
and mysql.default_password
. In which scenario we have to this way?
Or how could i secure my values from others?