InnoDB 表存在于 MySQL 中,但在将数据库复制到新服务器后表示它们不存在

发布于 2024-11-09 20:19:26 字数 290 浏览 4 评论 0原文

我使用 mysqldump 导出数据库,然后将其导入到另一台服务器上的 MySQL 中。现在,如果我执行“显示表格”,我可以看到所有表格,但我实际上无法选择或描述其中任何表格。

错误 1146 (42S02):表“mydatabase.user”不存在

我的所有表都是 InnoDB。我看到人们在使用 old_passwords 时遇到一个问题,所以我在 my.cnf 中明确将其设置为 0,并确保 mysql 表中的所有密码都是 41 个十六进制数字,因为它们应该是新密码。

I used mysqldump to export my database and then I imported it into MySQL on my other server. I can now see all my tables if I do "show tables" but I can't actually select from or describe any of them.

ERROR 1146 (42S02): Table 'mydatabase.user' doesn't exist

All of my tables are InnoDB. I saw one issue people had where they were using old_passwords, so I explicitly set that to 0 in my.cnf and I made sure all of the passwords in the mysql table were 41 hexadecimal digits as they should be for the new passwords.

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

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

发布评论

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

评论(3

笑看君怀她人 2024-11-16 20:19:26

原因“显示表格;”起作用是因为 mysqld 将仅扫描数据库目录中的 .frm 文件。只要它们存在,它就会看到表定义。

如果您将数据导入 MySQL 并出现此错误消息,我会立即执行以下命令:(顺便说一句,这是 MySQL 5.1.45,但无论如何都可以在 MySQL 5.x 中运行)

mysql> show engines;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                        | Transactions | XA   | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| BLACKHOLE  | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| CSV        | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| FEDERATED  | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| ARCHIVE    | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance         | NO           | NO   | NO         |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
8 rows in set (0.00 sec)

如果您导入数据的服务器into 说 InnoDB 被禁用,那么你就有大问题了。您应该执行以下操作:

1) 从新导入数据库服务器中删除所有数据

2) 清理 InnoDB 设置

3) 运行 SHOW ENGINES;并确保 InnoDB 完全正常运行!

4) 将 mysqldump 重新加载到新的导入服务器中

尝试一下!

The reason "show tables;" works is because mysqld will scan the database directory for .frm files only. As long as they exist, it sees a table definition.

If you imported the data into MySQL and this error message happens, the first thing I would immediately do is run this command: (BTW This is MySQL 5.1.45, but works in MySQL 5.x anyway)

mysql> show engines;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                        | Transactions | XA   | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| BLACKHOLE  | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| CSV        | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| FEDERATED  | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| ARCHIVE    | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance         | NO           | NO   | NO         |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
8 rows in set (0.00 sec)

If the server you imported the data into says InnoDB is disabled, then you have a big problem. Here is what you should do:

1) Drop all the Data from the New Import DB Server

2) Cleanup InnoDB Setup

3) run SHOW ENGINES; and make sure InnoDB is fully operational !!!

4) Reload the mysqldump into the new import server

Give it a Try !!!

过潦 2024-11-16 20:19:26

当我从Windows服务器更改为Linux服务器时,我遇到了这个问题。
表是文件,windows文件不区分大小写,但linux文件区分大小写。

在我的应用程序中,在sql查询中,有时我使用大写表名,有时使用小写,所以,有时我得到了与你相同的结果。

I had this problem when I changed from a windows server to a Linux server.
Tables are files, and windows files are case insesitive, but linux files are case sensitive.

In my aplication, in the sql queries, some times I used uppercase tablenames and other times lowercase, so, sometimes I obtained the same result as you.

江挽川 2024-11-16 20:19:26

我的情况是 SQLCA.DBParm 参数。

我使用了 SQLCA.DBParm = "Databse = "sle_database.text"" 但它必须

SQLCA.DBParm = "Database='" +sle_database.text+ "'"

解释:您将组合三个字符串:

a) Database='               - "Database='"

b) (name of the database)   - +sle_database.text+

c) ' - "'"

I my case it was SQLCA.DBParm parameter.

I used SQLCA.DBParm = "Databse = "sle_database.text"" but it must be

SQLCA.DBParm = "Database='" +sle_database.text+ "'"

Explain : you are going to combine three strings :

a) Database='               - "Database='"

b) (name of the database)   - +sle_database.text+

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