Error 1046, No database selected, ci running in MAMP |
[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
[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
[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
[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?
[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
[eluser]Apocryphon[/eluser]
I've already created stats_test in phpMyAdmin on my MAMP stack, though.
[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
[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? |
Welcome Guest, Not a member yet? Register Sign In |