【问题标题】:information_schema error when restoring database dump恢复数据库转储时出现 information_schema 错误
【发布时间】:2013-03-09 01:28:50
【问题描述】:

像往常一样,我使用 PMA 完成了完全导出。现在,当我尝试导入转储的数据时,我收到此错误:

#1044 - 用户 'root'@'localhost' 拒绝访问数据库 'information_schema'

发生了什么事?

【问题讨论】:

  • 检查顶部的“用户”标签,确保有 root localhost No ALL PRIVILEGES Yes 或类似条目
  • 刚刚做到了。一切都很好,甚至可以通过 mysql shell 编辑权限。据我所见,MySQL 会自动填充 information_schema,甚至进行 shell/batch 转储,忽略该数据库文件,但我不明白,为什么它以前可以工作。

标签: mysql phpmyadmin


【解决方案1】:

确保您的转储不包含 CREATE DATABASE information_schema,Information_Schema 不是您应该创建的东西。可能会或可能不会帮助您!

【讨论】:

  • 这是一个驻留在内存中的临时表
【解决方案2】:

information_schema 数据库中的每个表都是一个 TEMPORARY MEMORY TABLE

例如,通知information_schema.tables

mysql> show create table information_schema.tables\G
*************************** 1. row ***************************
       Table: TABLES
Create Table: CREATE TEMPORARY TABLE `TABLES` (
  `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '',
  `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
  `TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
  `TABLE_TYPE` varchar(64) NOT NULL DEFAULT '',
  `ENGINE` varchar(64) DEFAULT NULL,
  `VERSION` bigint(21) unsigned DEFAULT NULL,
  `ROW_FORMAT` varchar(10) DEFAULT NULL,
  `TABLE_ROWS` bigint(21) unsigned DEFAULT NULL,
  `AVG_ROW_LENGTH` bigint(21) unsigned DEFAULT NULL,
  `DATA_LENGTH` bigint(21) unsigned DEFAULT NULL,
  `MAX_DATA_LENGTH` bigint(21) unsigned DEFAULT NULL,
  `INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL,
  `DATA_FREE` bigint(21) unsigned DEFAULT NULL,
  `AUTO_INCREMENT` bigint(21) unsigned DEFAULT NULL,
  `CREATE_TIME` datetime DEFAULT NULL,
  `UPDATE_TIME` datetime DEFAULT NULL,
  `CHECK_TIME` datetime DEFAULT NULL,
  `TABLE_COLLATION` varchar(32) DEFAULT NULL,
  `CHECKSUM` bigint(21) unsigned DEFAULT NULL,
  `CREATE_OPTIONS` varchar(255) DEFAULT NULL,
  `TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

mysql>

另外,请注意,每当您使用 --all-databases 运行 mysqldump 时,information_schema 永远不会显示。

information_schema 数据库的唯一目的是存储物理文件的元数据和数据库中表的逻辑描述。每当您运行service mysql start 时,mysqld 都会创建所有information_schema 表。之后,mysqld 用有关物理文件的信息填充这些临时内存表。

在重新加载数据库方面,请让 mysqld 处理 information_schema 数据库。 MySQL information_schema请见my DBA StackExchange post from June 15, 2011

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-12-20
    • 1970-01-01
    • 2012-06-14
    • 2012-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多