Showing Error: mysqli::real_connect(): (28000/1045): Access denied for user 'user'@'192.188.145.163' (using password: YES)
26,859
In cpannel actually username and 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 this 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 to a database, you need to ensure that:
- You've created a database
- You've created a database username
- You've assigned that user with privileges to your database
Your MySQL connections may use 127.0.0.1 or the IP address of your server, and MySQL will reject the connection if access isn't granted for the specific IP address used.
Verify the permission tables (reloading grants if required) on the server and that you're connecting to
Regrant Preveliges by :
GRANT ALL PRIVILEGES on *.* to 'user'@'IP' IDENTIFIED BY '*UserPass*';
Author by
Mamun Sabuj
Updated on May 14, 2020Comments
-
Mamun Sabuj almost 4 years
This is a codeigniter project. my given database information is right.It works perfectly in localhost. But after uploading my project in hosting site, it still shows an 'access denied' error.
This is my 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 I solve this ?
-
Mamun Sabuj over 8 yearsit works perfectly in localhost. But shows error after uploading my project in hosting site.
-
Abdulla Nilam over 8 yearswhat is your hosting provide ??