Create MySQL Database at the Localhost. Create Database. Now return to the homepage of phpmyadmin. Create a Folder in htdocs. Create Database Connection File In PHP. Create new php file to check your database connection. Run it! Create Database Connection. Connect MySQL Database with PHP.