为什么在 CakePHP 中重命名数据库后出现错误?

发布于 2024-07-20 16:43:40 字数 249 浏览 5 评论 0原文

在上传使用 cakephp 创建的应用程序后,我发现我必须重命名数据库。 我相应地重命名了数据库,并更改了“config”文件夹中的database.php 文件中的设置。 但我的应用程序仍然没有运行。 我收到此错误消息 “缺少数据库表” “错误:未找到模型主题的数据库表 tbl_topics。”

我已经仔细检查了数据库中 tbl_topics 的存在(它在数据库中),但应用程序说“找不到表” 可能是什么问题,请帮帮我...

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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

半窗疏影 2024-07-27 16:43:40

确保您在 config.php 文件中设置的 host/user/pass 有权访问该数据库和表

您也可以尝试运行 cake schemagenerate --dry< /code> 会反馈您可能遇到的任何连接问题。

另外,请查看您的 app/tmp/logs 以获取有关您遇到的问题的一些额外信息

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

爱的那么颓废 2024-07-27 16:43:40

获取您用于 cakephp 的用户名和密码及其数据库连接,并从命令行连接到数据库。 我假设你使用的是unix类型的系统和mysql?

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

...然后尝试运行一个简单的选择:

SELECT * FROM tbl_topics

如果出现错误,它至少会识别出这是一个低级数据库问题,可能的解决方案是您需要向该用户授予权限以从中进行选择数据库。 该用户当前的访问级别可能正在授予旧名称下的数据库访问权限。

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.

緦唸λ蓇 2024-07-27 16:43:40

您可能也上传了缓存文件。 确保删除 /app/tmp/cache/* 中的所有文件

警告:不要删除文件夹,仅删除文件!

另外,请确保您的 tmp 文件夹和所有子文件夹都是全局可写的。

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.

冷弦 2024-07-27 16:43:40

最后一个想法是检查您的模型缓存。 我不知道为什么这会影响您的连接,但值得一看 app/tmp/cache

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.

吃→可爱长大的 2024-07-27 16:43:40

:-)
终于明白了.... :-D

我忘记分配用户对主服务器上应用程序数据库的访问权限。 分配权限后一切顺利。

不管怎样,谢谢大家的宝贵回答...它帮助我获得了一些关于 cakephp 的额外知识。

:-)
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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文