CodeIgniter Forums
Database Error Occurred - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: Database Error Occurred (/thread-75678.html)

Database Error Occurred - mycoban - 03-04-2020

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 

'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.

RE: Database Error Occurred - John_Betong - 03-04-2020

> 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.

RE: Database Error Occurred - InsiteFX - 03-04-2020

Here is code for testing a database connection etc;

PHP Code:
 * 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;

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

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

RE: Database Error Occurred - tweenietomatoes - 03-04-2020

isn't that dbdriver mysqli instead of mysql?

RE: Database Error Occurred - InsiteFX - 03-05-2020

MySQL is depreciated. So you must now use MySQLi.