How do I connect with my database with PHP? Use the following code to connect with your database with a PHP script: mysql_connect(‘mysqlhost’, ‘USERNAME’, ‘PASSWORD’); mysqlselectdb(‘DATABASENAME’); Updated on 8 March 2020 Was this article helpful? Yes No