Skip to content

Instantly share code, notes, and snippets.

@ron4stoppable
Forked from chales/db-connect-test.php
Last active April 28, 2016 13:36
Show Gist options
  • Save ron4stoppable/04d627bc74e220d0bed14761045940d3 to your computer and use it in GitHub Desktop.
Save ron4stoppable/04d627bc74e220d0bed14761045940d3 to your computer and use it in GitHub Desktop.
Script for a quick PHP MySQL DB connection test.
<?php
# $ php -f db-connect-test.php
# a quick and easy script for db connectivity
$dbname = 'name'; // DB name
$dbuser = 'user'; // user name
$dbpass = 'pass'; // password
$dbhost = 'host'; // host
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
mysql_select_db($dbname) or die("Could not open the db '$dbname'");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment