I connect my Rails app to MySQL database, working with that and after turning off the laptop and starting Rails and MySQL server again, I get the error
我将我的Rails应用程序连接到MySQL数据库,使用它并在关闭笔记本电脑并再次启动Rails和MySQL服务器后,我收到错误
ActionView::Template::Error (Mysql2::Error: Table 'database.table' doesn't exist: SHOW FULL FIELDS FROM `table`):
This is in Rails log.
这是在Rails日志中。
When I log in into MySQL through the terminal
当我通过终端登录MySQL时
mysql -u root -p
choose a database and then try to display data from a table, like
选择一个数据库,然后尝试显示表中的数据,如
mysql> select * from users;
ERROR 1146 (42S02): Table 'database.users' doesn't exist
I google this issue and found a temporarily solution, but this is not appropriate because it involves remove all old data in the respective database:
我谷歌这个问题并找到了一个临时解决方案,但这不合适,因为它涉及删除相应数据库中的所有旧数据:
cd /usr/local/mysql/data
sudo rm -rf database_name
So I would like to ask you for help - how to properly figure out this issue?
所以我想请你帮忙 - 如何正确解决这个问题?
Thank you
1 个解决方案
#1
0
Looks like you're using rails, did you issue the command
看起来你正在使用rails,你发出了命令吗?
rake db:migrate
And while you're in mysql I suggest you to get the list of available tables with:
当你在mysql中时,我建议你获取可用表的列表:
show tables;
#1
0
Looks like you're using rails, did you issue the command
看起来你正在使用rails,你发出了命令吗?
rake db:migrate
And while you're in mysql I suggest you to get the list of available tables with:
当你在mysql中时,我建议你获取可用表的列表:
show tables;