Gaurav Sharma
Gaurav Sharma

Reputation: 2848

Why am I getting errors after renaming my database in CakePHP?

After I uploaded my application created using cakephp, I found out that I had to rename the database. I renamed my database accordingly and changed the settings in the database.php file in the "config" folder. But my application is still not running. I am being shown this error message "Missing Database table" "Error: Database table tbl_topics for model Topic was not found."

I have double checked the existence of tbl_topics in the database (it is there in the database) but the application says "table not found" what might be the problem, please help me out...

Upvotes: 0

Views: 904

Answers (5)

Gaurav Sharma
Gaurav Sharma

Reputation: 2848

:-) finally got it.... :-D

I forgot to assign the user access to my application's database on main server. After assigning the permissions all went fine.

Anyways thank you all for your valuable answers... It helped me gain some additional knowledge about cakephp.

Upvotes: 0

dr Hannibal Lecter
dr Hannibal Lecter

Reputation: 6721

You have probably uploaded your cache files as well. Make sure you delete all the files in /app/tmp/cache/*

Warning: Don't delete the folders, files only!

Also, make sure your tmp folder and all the subfolders are world-writable.

Upvotes: 1

Rob Wilkerson
Rob Wilkerson

Reputation: 41236

One last thought would be to check your model cache. I don't know why that would impact you with respect to connecting, but it's worth taking a look in app/tmp/cache.

Upvotes: 0

Neil Trodden
Neil Trodden

Reputation: 4728

Take the username and password you are using for cakephp and it's db connection and connect to the database from the command line. I'm presuming you are using a unix-type system and mysql?

mysql --user=user_name --password=your_password db_name

...and then try to run a simple select:

SELECT * FROM tbl_topics

If you get an error there, it will at least identify that it is a low level db problem and the likely solution is that you need to grant permissions to that username to select from that database. Your current access levels for that user is probably granting access to the db under the old name.

Upvotes: 1

duckyflip
duckyflip

Reputation: 16499

Make sure the host/user/pass that you've set-up in the config.php file have access to that database and table

You could also try running cake schema generate --dry which will spit back any problems with the connection that you might be having

Also have a look in your app/tmp/logs for some extra information on the problems you are experiencing

Upvotes: 1

Related Questions