php - Showing Error: mysqli::real_connect(): (28000/1045): Access denied for user 'user'@'192.188.145.163' (using password: YES) -


this codeigniter project. given database information right.it works in localhost. after uploading project in hosting site, still shows 'access denied' error.

this database:

 $db['default'] = array(     'dsn' => '',     'hostname' => 'telihatyhighschool.edu.bd',     'username' => 'db_username',     'password' => 'db_password',     'database' => 'db_name',     'dbdriver' => 'mysqli',     'dbprefix' => '',     'pconnect' => false,     'db_debug' => true,     'cache_on' => false,     'cachedir' => '',     'char_set' => 'utf8',     'dbcollat' => 'utf8_general_ci',     'swap_pre' => '',     'encrypt' => false,     'compress' => false,     'stricton' => false,     'failover' => array() ,     'save_queries' => true ); 

how can solve ?

in cpannel username , database name has cpanel username prefix eg

$active_group = 'default'; $active_record = true;  $db['default']['hostname'] = 'localhost'; //literaly put localhost $db['default']['username'] = 'cpanelusername_root'; $db['default']['password'] = 'password'; $db['default']['database'] = 'cpanelusername_db name'; $db['default']['dbdriver'] = 'mysqli'; ///use extension $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = true; $db['default']['db_debug'] = true; $db['default']['cache_on'] = false; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = true; $db['default']['stricton'] = false; 

in more simple words

host = localhost (literally put localhost) database name = (cpanelusername_databasename) database username = (cpanelusername_databaseusername) database password = (******) 

note: when connecting database, need ensure that:

  1. you've created database
  2. you've created database username
  3. you've assigned user privileges database

your mysql connections may use 127.0.0.1 or ip address of server, , mysql reject connection if access isn't granted specific ip address used.

verify permission tables (reloading grants if required) on server , you're connecting to

regrant preveliges :

grant privileges on *.* 'user'@'ip' identified '*userpass*'; 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -