为什么在 CakePHP 中重命名数据库后出现错误?
在上传使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
确保您在 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 tableYou could also try running
cake schema generate --dry
which will spit back any problems with the connection that you might be havingAlso have a look in your
app/tmp/logs
for some extra information on the problems you are experiencing获取您用于 cakephp 的用户名和密码及其数据库连接,并从命令行连接到数据库。 我假设你使用的是unix类型的系统和mysql?
...然后尝试运行一个简单的选择:
如果出现错误,它至少会识别出这是一个低级数据库问题,可能的解决方案是您需要向该用户授予权限以从中进行选择数据库。 该用户当前的访问级别可能正在授予旧名称下的数据库访问权限。
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?
...and then try to run a simple select:
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.
您可能也上传了缓存文件。 确保删除 /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.
最后一个想法是检查您的模型缓存。 我不知道为什么这会影响您的连接,但值得一看
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
.:-)
终于明白了.... :-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.