• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database connection error when live on server (SOLVED)

#1
I configure a VirtualBox VM for my server running UBUNTU (LAMP setup) and now after putting my project on the server it fails to connect to the database.

Error

PHP Code:
mysqli::real_connect(): (HY000/1045): Access denied for user 'usr'@'ip' (using passwordYES



my application/config/database config


PHP Code:
$active_group 'default';
$query_builder TRUE;

$db['default'] = array(
    
'dsn'    => '',
    
'hostname' => '***',
    
'username' => 'miko',
    
'password' => '***',
    
'database' => 'handler_monitoring',
    
'dbdriver' => 'mysqli',
    
'dbprefix' => '',
    
'pconnect' => FALSE,
    
'db_debug' => (ENVIRONMENT !== 'production'),
    
'cache_on' => FALSE,
    
'cachedir' => '',
    
'char_set' => 'utf8',
    
'dbcollat' => 'utf8_general_ci',
    
'swap_pre' => '',
    
'encrypt' => FALSE,
    
'compress' => FALSE,
    
'stricton' => FALSE,
    
'failover' => array(),
    
'save_queries' => TRUE
); 
Anyway a simple database connection from a pure PHP works, I don't understand why CI wont.
Pure PHP connection that works on the server
PHP Code:
("127.0.0.1""my_user""my_password""my_db" 
Turns out I had the wrong privileges.
Reply

#2
The error message is pretty clear, you do connect to the MySQL server but it says: Access denied for user 'usr'@'ip' (using password: YES).

So either the username / password combination is false or that user is bound to a specific (different) IP adres.

PS, never post real passwords on a public forum, even if that database is on a local network.
Reply

#3
(07-02-2017, 01:51 PM)Diederik Wrote: The error message is pretty clear, you do connect to the MySQL server but it says: Access denied for user 'usr'@'ip' (using password: YES).

So either the username / password combination is false or that user is bound to a specific (different) IP adres.

PS, never post real passwords on a public forum, even if that database is on a local network.

I got it working thanks, after posting this thread I realized it and fix it but I never got to say it here xD
Reply

#4
Please add SOLVED to the subject line
On the package it said needs Windows 7 or better. So I installed Linux.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.