![]() |
Error 1046, No database selected, ci running in MAMP - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Error 1046, No database selected, ci running in MAMP (/showthread.php?tid=37195) |
Error 1046, No database selected, ci running in MAMP - El Forum - 01-01-2011 [eluser]Apocryphon[/eluser] I have ci installed on a regular MAMP stack, and I'm working on this tutorial. However, I have only gone through the Created section, and currently I am getting a No database selected error. Model: Code: <?php View: Code: <?php $this->load->helper('form'); ?> Controller: Code: <?php database.php Code: $db['default']['hostname'] = "localhost:8889"; config.php Code: $config['base_url'] = "http://localhost:8888/ci/"; So, how come it's giving me this error message? Code: A Database Error Occurred Error 1046, No database selected, ci running in MAMP - El Forum - 01-01-2011 [eluser]InsiteFX[/eluser] Not sure with MAMP, but with XAMPP you do not need the port number :8889 on base_url and database hostname. Try removing the port number. InsiteFX Error 1046, No database selected, ci running in MAMP - El Forum - 01-01-2011 [eluser]Apocryphon[/eluser] Sorry, that doesn't work. The 8888 is required. Error 1046, No database selected, ci running in MAMP - El Forum - 01-01-2011 [eluser]InsiteFX[/eluser] Ok!, was not sure, is the hostname port 8889 or should it also be 8888 ? Also did you create the database stats_test ? CI will look for the stats_test database and return the error if it can not find it! InsiteFX Error 1046, No database selected, ci running in MAMP - El Forum - 01-01-2011 [eluser]Apocryphon[/eluser] Okay, so I've tried it so that in database.php the default db hostname is localhost:8889"; And in config.php I have the baseurl set to "http://localhost:8889/ci/"; I tried it and a file containing this error was created: Got packets out of order What now? Error 1046, No database selected, ci running in MAMP - El Forum - 01-01-2011 [eluser]InsiteFX[/eluser] You still did not say if you created the database stats_test CodeIgniter will not run without errors until you create the database. InsiteFX Error 1046, No database selected, ci running in MAMP - El Forum - 01-01-2011 [eluser]Apocryphon[/eluser] I've already created stats_test in phpMyAdmin on my MAMP stack, though. Error 1046, No database selected, ci running in MAMP - El Forum - 01-01-2011 [eluser]InsiteFX[/eluser] Ok, this maybe what your looking for not sure! port - The database port number. Currently only used with the Postgres driver. To use this value you have to add a line to the database config array. Code: $db['default']['port'] = 5432; CodeIgniter User Guide - Database Configuration Why do you need to include a port number? InsiteFX Error 1046, No database selected, ci running in MAMP - El Forum - 01-02-2011 [eluser]Apocryphon[/eluser] Okay, different track of action: what simple thing can I do to make sure that CodeIgniter can read from my databases in MAMP? |