I've moved my site to the staging server but now I'm getting a craft can't connect to the database with credentials in craft/config/db.php
Thing is I uploaded this script with the same credentials and it connects just fine. Any idea what I could be doing wrong
<?php # Fill our vars and run on cli # $ php -f db-connect-test.php $dbname = 'name'; $dbuser = 'user'; $dbpass = 'pass'; $dbhost = 'localhost'; $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'"); echo "connected to the database";
My full db.php file with actual db creds removed - updated to include domain from live site.
<?php /** * Database Configuration * * All of your system's database configuration settings go in here. * You can see a list of the default settings in craft/app/etc/config/defaults/db.php */ return array( '*' => array( 'tablePrefix' => 'craft', ), 'nec.dev' => array( 'server' => 'localhost', 'user' => 'root', 'password' => 'root', 'database' => 'nec', ), 'nec.dev.stagingdomain.com' => array( 'server' => 'localhost', 'user' => 'staging-user', 'password' => 'staging-password', 'database' => 'staging-database', ), 'nec-inc.com' => array( 'server' => 'localhost', 'user' => '', 'password' => '', 'database' => '', ), );
I can't figure out why this doesn't work on staging when the same credentials work with the connection testing script.