Best way to connect to MySQL with PHP securely

mysql, php, security

Solution

Suggestion: You should probably never be running as root; create another account and give it the 'least' privileges required for your site.

Problem

I want some input on what you guys think is the most secure way to connect to a MySQL database using PHP. Currently the way I'm doing it is a utility PHP file that I include in the top of all my other PHP files. The utility PHP file is this: ``` <?php if(!defined('IN_PHP')){ die("hackerssss"); } $mysql_host = "localhost"; $mysql_user = "root"; $mysql_pass = "root"; $mysql_db = cokertrading; ?> ``` Any suggestions?

Original source

Related problems