Welcome Guest, Not a member yet? Register   Sign In
Database Error Occurred
#1

I tried to migrate the database from one server to another.   

After set up the database and import mysql file.  I went to change information under 
application/config/database.php

'hostname' => 'localhost',
'username' => 'root',
'password' => '12345',
'database' => 'xxxxxx',
'dbdriver' => 'mysql',


However, I get the following error.

Unable to select the specified database: xxxxxxx
Filename: core/CodeIgniter.php
Line Number: 500


Please kindly advise where does it goes wrong.
Reply
#2

(This post was last modified: 03-04-2020, 08:38 AM by John_Betong.)

@mycoban,
> Please kindly advise where does it goes wrong.

Try connecting either with MySqli or PDO without using CodeIgniter and ensure the login parameters are correct.
Reply
#3

Here is code for testing a database connection etc;

PHP Code:
<?php
/**
 * Fill our vars and run on cli
 * db-connect-test.php
 */

$dbname 'name';
$dbuser 'user';
$dbpass 'pass';
$dbhost 'host';

$connect mysqli_connect($dbhost$dbuser$dbpass) or die("Unable to Connect to '$dbhost'");
mysqli_select_db($connect$dbname) or die("Could not open the db '$dbname'");

$test_query "SHOW TABLES FROM $dbname";
$result mysqli_query($connect$test_query);

$tblCnt 0;

while(
$tbl mysqli_fetch_array($result))
{
  $tblCnt++;
  #echo $tbl[0]."<br />\n";
}

if (!
$tblCnt)
{
  echo "There are no tables<br />\n";
}
else
{
  echo "There are $tblCnt tables<br />\n";

What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

isn't that dbdriver mysqli instead of mysql?
Reply
#5

MySQL is depreciated. So you must now use MySQLi.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB