⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Can't connect to DB



Tommy

Tommy
  • profile picture
  • Member

Posted 29 November 2015 - 09:32 AM

Hi there!

 

First of all: I'm am almoust totally ignorant of php and totally ignorant of sql.

 

Hearing about Code Igniter (CI) and Grocery Crud (GC) I wanted to make a test of how difficult could be to create a Mysql databse and manage it with CI + GC.

 

I have my websites in this location: D:\Web\Sites

And my CI + GC project in this folder: D:\Web\Sites\code-igniter\code-igniter-grocery-crud

I have installed Mamp Pro with "grocery-crud" host configured with the above folder as Document root.

 

After having correctly installed CI and seeing the right welcome page landing on http://grocery-crud/ I followed the instructions of this newbies GC installation guide:http://www.grocerycrud.com/documentation/create-crud-codeigniter-tutorial.

 

Having completed step 3 I get the error you can see in the "Database Error.png" attachment.

 

I tried changing "hostname" index in $db['default'] array in /application/config.php of my CI project with "grocery-crud" but still having the same result.

 

Continuing on reading the guide at step 4 is written to "Create your table in your database".
«Gosh... I hoped I could do it from a GC UI interface... :-(», I thought...
Then the guide continue saying to to "insert" the following sql query which is then showed.
«insert how!?» I asked myself...
So I thought: «maybe I have to create "my_new_cms" db first by using phpmyadmin?».
I tried to do it and It seems to me I succeded, as you can see in "my_new_cms_db.png" attachment.

 

Back to GC guide step 3 test I again found the same situation as the initial one...

 

So I asked myself: «maybe it's a matter of users, privileges or that kind of stuff?»

I play a bit with PhpMyAdmin to create a new "root" user with "grocery-crud" as Host value but, again, same situation at guide step 3 test...

So I tried to creat a new user "tommy" with "grocery-crud" as host value and then editing the CI config array accordingly and again same situation with the only variant of "tommy@localhost" instead of "root@localhost" in the same error message...

 

At this point I gave up...

What the hell I'm doing wrong?

 

I think the problem could be that "@localhost" in the error message which maybe it should be "@grocery-crud", given tha I'm using a Mamp Pro custom host with that name... could it be?

 

Please help me to understand...


Tommy

Tommy
  • profile picture
  • Member

Posted 29 November 2015 - 12:19 PM

I found the problem... I shuold have imported Grocery Crud examples database with import tool from phpmyadmin and the right password for the db seems to be "root", not "1234" as the guide show.