为什么它显示错误 1146“表‘student.db’”不存在,尽管我已经创建了“学生”;数据库?
创建数据库“student”后,当我设置有关该数据库的权限时,出现错误,并显示消息“错误 1146(42S02):表“student.db”不存在。 我不明白为什么会发生这种错误,尽管我确实创建了数据库。
你能让我知道问题是什么吗?
请参考以下步骤进行重现。
Start mysql with root account
create database student;
use student;
insert into db values ('%', 'student', 'beginner', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y');
发生错误......“错误1146(42S02):表'student.db'不存在。
我可以使用'showdatabase;'检查学生数据库是否存在。但这条消息说“student.db”不存在。
After I created database 'student', when I set authorities about the db, error occurred with the message "ERROR 1146(42S02) : Table 'student.db' doesn't exist.
I can't understand why this kind error happened, though I surely created the database.
Could you let me know what the problem is?
Please, refer below step to reproduce.
Start mysql with root account
create database student;
use student;
insert into db values ('%', 'student', 'beginner', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y');
Error occurred...... "ERROR 1146(42S02) : Table 'student.db' doesn't exist.
I can check that student database exists by using 'show databases;'. but this message says "student.db" doesn't exist.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您似乎正在尝试通过直接修改系统表来授予权限。每个 MySQL 实例中都有一个表
mysql.db
,但该表不属于您的student
数据库。我建议您使用 GRANT 语句,而不是直接修改系统数据:
It appears that you are trying to grant privileges by modifying the system tables directly. There is a table
mysql.db
in every MySQL instance, but that table does not belong to yourstudent
database.I recommend you use the GRANT statement instead of tinkering with system data directly:
Student.db 引用
student
数据库中名为 db 的表。显然您还没有创建此表...顺便说一句,请仔细阅读错误消息以及您认为的问题所在。
student.db refers to a TABLE named db inside the
student
database. You obviously did not create this table yet...b.t.w. read carefully the error message and what you thought the problem is.
此语句
假设在某个时刻,名为
db
的表已创建:根据您在此处显示的内容,您似乎尚未创建它;您期望它的定义从何而来?
This statement
assumes that at some point, the table named
db
has been created:Based on what you've shown here, you don't seem to have created it; where did you expect its definition to come from?
您已创建数据库,但尚未在其中创建任何表。您告诉 MySQL 将数据插入到名为“db”的表中,但该表并不存在。您需要这样的事情:
数据库只是一个容器。它必须至少定义一个表才能真正有用。
You've created a database, but haven't created any tables in it. You're telling MySQL to insert your data into a table name "db", which doesn't exist. You need to have something like this goin gon:
A database is just a container. It must have at least ONE table defined in it to actually be useful.
问题是...
你有一个带有“InnoDB ENGINE”的数据库......
我的解决方案是...
你必须有一个“MyISAM引擎”,
怎么改?...发现你的环境可能是
在LINUX上,只需添加以下行即可,
然后重新启动mysql:
The Problem was...
You have a DB with "InnoDB ENGINE".......
My Solution was...
You must have a "MyISAM ENGINE",
how to change?... find on your environment may be with
on LINUX, simply add the following line to
Then restart mysql: