Codeigniter Database Error Line Number 346
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the
Codeigniter Database Error Handling
workings and policies of this site About Us Learn more about codeigniter a database error occurred Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions
Codeigniter Database Error Message
Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. filename core/loader.php line number 347 Join them; it only takes a minute: Sign up code igniter error: Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346 up vote -1 down vote favorite 1 I'm developing a website application using codeigniter at localhost and then i host it in hawkhost. At localhost it runs well, but at host unable to connect to your database server using the provided settings. line number 124 there's and error : Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346 this is my db configuration $active_group = 'default'; $active_record = TRUE; $db['default']['hostname'] = 'localhost'; $db['default']['username'] = '****'; $db['default']['password'] = '****'; $db['default']['database'] = '****'; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = FALSE; $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; I know many people already asked this problem but it doesn't seems to solve anything on my case. changing $db['default']['db_debug'] = TRUE; to false only hide the error but when i tried to get data from query it doesn't return anything. I also tried to change $db['default']['pconnect'] = FALSE; to true and still doesn't work. Any help please? php mysql codeigniter share|improve this question edited Nov 6 '14 at 4:19 Sulthan Allaudeen 6,902101839 asked Nov 6 '14 at 3:32 stormrage 1521112 2 check the credentials and i think credentials should be confidential.. –Sougata Bose Nov 6 '14 at
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About
Unable To Connect To Your Database Server Using The Provided Settings. In Codeigniter
Us Learn more about Stack Overflow the company Business Learn more about hiring db_driver.php line number: 124 developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the
How To Fix Unable To Connect To Your Database Server Using The Provided Settings
Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up CodeIgniter: Unable to connect to your http://stackoverflow.com/questions/26771274/code-igniter-error-unable-to-connect-to-your-database-server-using-the-provided database server using the provided settings Error Message up vote 31 down vote favorite 17 I have been using CI just fine using the MySQL driver. I want to use the mysqli driver instead, but as soon as I change it (just add the āiā at the end of mysql, and added the port number) I get the following error message A Database Error Occurred Unable http://stackoverflow.com/questions/7254049/codeigniter-unable-to-connect-to-your-database-server-using-the-provided-settin to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 232 my setting look like this: $db['default']['hostname'] = $hostname; $db['default']['username'] = $username; $db['default']['password'] = $password; $db['default']['database'] = $database; $db['default']['dbdriver'] = 'mysqli'; $db['default']['port'] = "3306"; $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; where $hostname = 'localhost'; $username = 'myusernamegoeshere'; $password = 'mypasswordgoeshere'; $database = 'mydatabasenamegoeshere'; Using: CI 2.0.2 php 5.3.4 Apache/2.2.17 (Unix) mysql 5.5.13 mysql.default_port 3306 Am I doing anything wrong? Thank you, php mysql codeigniter connection mysqli share|improve this question asked Aug 31 '11 at 7:52 Onema 2,99084175 Is your DB Server started? –Ashwini Dhekane Jan 10 '12 at 17:52 add a comment| 11 Answers 11 active oldest votes up vote 26 down vote accepted For me the issue was in the php.ini file. The property mysql.default_socket was pointing to file in a non-existent directory. The property was pointing to /var/mysql/mysql.sock but in OSX, the file was located in /tmp/mysql.sock. Once I updated the entry in php.ini and restarted the webserver, the issue was resolved. share|improve
someone asked me to make a tutorial about Connecting to Database in CodeIgniter Framework. In order to make connection to database https://arjunphp.com/connect-to-mysql-database-in-codeigniter/ in Ci , we need to do only few configuration changes in your database.php config file which is located at application / config / database.php.123456789101112131415$db['default']['hostname'] = "localhost"; // set you host name$db['default']['username'] = "root"; // set MySQL username $db['default']['password'] = ""; // set MySQL userpassword$db['default']['database'] = "your_database_name"; // set your database name$db['default']['dbdriver'] = "mysql"; $db['default']['dbprefix'] = "";$db['default']['pconnect'] database error = TRUE;$db['default']['db_debug'] = FALSE;$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;After making changes to database.php config file, we can connect to the database in two ways. First one is Automatic loading, to do this just go to autoload.php file which is located at application/ config / database.php file. Then add codeigniter database error ‘database' to $autoload[‘libraries'] = array() array.1$autoload ['libraries'] = array ('database'); / / autoload databaseAnother way of loading is manual loading with $this->load->database() method. place this line to load database in your controller contractor or with in the method(s).123$db = $this->load->database();$query = $db->get('users');// users is table anmevar_dump($query);Sometimes you may get fallowing error i got this error message with net4india shared hosting environment12345Unable to connect to your database server using the provided settings.Filename: core/Loader.phpLine Number: 346In order to fix this issue , i simple changed config values of pconnect to false.1$db['default']['pconnect'] = FALSE;That's it for database connecting and loading in CI, if you have any issues , let me know via comments.I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.ArjunI am Arjun from Hyderabad (India). I have been working as a PHP Developer from last 6+ years, and its my passion to learn new things and implement them as a practice. Aside from wo