source

mysql 오류:테이블 "mysql".innodb_table_stats"를 찾을 수 없습니다.

factcode 2023. 9. 11. 22:14
반응형

mysql 오류:테이블 "mysql".innodb_table_stats"를 찾을 수 없습니다.

mysql 5.6 커뮤니티 에디션에서 다음 오류가 발생합니다.

: 오류:테이블 "mysql".innodb_table_stats"찾을 수 없습니다.InnoDB: 재계산"my database" 테이블에 대해 요청된 영구 통계의. "mytable"필요한 영구 통계 스토리지가 없거나 손상되었습니다. 
대신 일시적인 통계를 사용합니다.

이 오류를 수정하려면 어떻게 해야 합니까?

이것으로 문제가 해결되었습니다.

/* 윈도우즈 7 시스템의 MySQL 5.6.10에 대한 윈도우즈 설치 관리자 문제에 대한 임시 수정.저는 깨끗하게 설치된 MySql에서 절차를 수행했고, 그것은 저에게 효과가 있었고, 적어도 로그의 innodb 오류 줄을 막았고, 일시적 innodb 테이블의 사용을 막았습니다.그러니, 당신 책임하에..

  1. mysql에서 테이블을 삭제합니다. innodb_index_drop innodb_table_drop innodb_master_info slave_master_info slave_log_info slave_worker_info

  2. 위 표의 .frm & .ibd를 모두 삭제합니다.

  3. 이 파일을 실행하여 위의 테이블을 다시 만듭니다(source five-silver.sql).

  4. 내 sqld를 다시 시작합니다.건배, CNL */

CREATE TABLE `innodb_index_stats` (
  `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `table_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `index_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `stat_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `stat_value` bigint(20) unsigned NOT NULL,
  `sample_size` bigint(20) unsigned DEFAULT NULL,
  `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;

CREATE TABLE `innodb_table_stats` (
  `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `table_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `n_rows` bigint(20) unsigned NOT NULL,
  `clustered_index_size` bigint(20) unsigned NOT NULL,
  `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`database_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;

CREATE TABLE `slave_master_info` (
  `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file.',
  `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log currently being read from the master.',
  `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.',
  `Host` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'The host name of the master.',
  `User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',
  `User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',
  `Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.',
  `Connect_retry` int(10) unsigned NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',
  `Enabled_ssl` tinyint(1) NOT NULL COMMENT 'Indicates whether the server supports SSL connections.',
  `Ssl_ca` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.',
  `Ssl_capath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.',
  `Ssl_cert` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.',
  `Ssl_cipher` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.',
  `Ssl_key` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.',
  `Ssl_verify_server_cert` tinyint(1) NOT NULL COMMENT 'Whether to verify the server certificate.',
  `Heartbeat` float NOT NULL,
  `Bind` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server',
  `Ignored_server_ids` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs',
  `Uuid` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.',
  `Retry_count` bigint(20) unsigned NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.',
  `Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',
  `Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',
  `Enabled_auto_position` tinyint(1) NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.',
  PRIMARY KEY (`Host`,`Port`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Master Information';

CREATE TABLE `slave_relay_log_info` (
  `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
  `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
  `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
  `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
  `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
  `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
  `Number_of_workers` int(10) unsigned NOT NULL,
  `Id` int(10) unsigned NOT NULL COMMENT 'Internal Id that uniquely identifies this record.',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Relay Log Information';

CREATE TABLE `slave_worker_info` (
  `Id` int(10) unsigned NOT NULL,
  `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `Relay_log_pos` bigint(20) unsigned NOT NULL,
  `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `Master_log_pos` bigint(20) unsigned NOT NULL,
  `Checkpoint_relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `Checkpoint_relay_log_pos` bigint(20) unsigned NOT NULL,
  `Checkpoint_master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `Checkpoint_master_log_pos` bigint(20) unsigned NOT NULL,
  `Checkpoint_seqno` int(10) unsigned NOT NULL,
  `Checkpoint_group_size` int(10) unsigned NOT NULL,
  `Checkpoint_group_bitmap` blob NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Worker Information';

최근 프로덕션 서버에서 이 문제를 발견했는데 테이블 삭제, 파일 삭제 등과 관련된 가장 일반적인 답변이 조금 불안했습니다!

그래서 저는 나중에 이 글을 읽는 사람들에게 제 경우 오류의 실제 원인이 루트 파티션 채우기 때문이라는 점을 지적하는 것이 유용할 것이라고 생각했습니다.나는 그 당시에 mysql 덤프를 만들고 있었고 그것을 잘못된 장소에 저장했습니다.따라서 솔루션은 디스크 공간을 일부 확보하고 서비스를 다시 시작하는 것이었습니다.

MYSQL의 구조를 엉망으로 만들고 조금 더 위험해질 가능성이 있는 표준 솔루션으로 넘어가기 전에 이러한 상황이 발생하지 않는지 확인해 보는 것이 좋습니다.

행운을 빌어요,

이 mysql 문서를 읽고 자세한 내용을 알아보십시오.Persistent Statistics.

이 기능을 비활성화하려면 다음을 추가합니다.innodb_stats_persistent = 0로.my.cfgmysql 서버를 재시작합니다.

동일한 문제이지만 충돌 테이블'gtid_slave_pos', 만들기gtid_slave_pos

CREATE TABLE `gtid_slave_pos` (
  `domain_id` int(10) unsigned NOT NULL,
  `sub_id` bigint(20) unsigned NOT NULL,
  `server_id` int(10) unsigned NOT NULL,
  `seq_no` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`domain_id`,`sub_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Replication slave GTID state';

이것은 저에게 허가 문제로 드러났습니다.권한이 잠기지 않는 개발 시스템에 있었기 때문에 충분히 쉽게 수정할 수 있었습니다.

sudo chmod -R 775 /usr/local/mysql/data

그게 해결이 된다면, 좋아요하지만 생산 기계에 문제가 있다면, 제 솔루션보다 좀 더 철저하게 허가를 조사하고 싶을 수도 있습니다.

그 대신에 당신은 이것을 시도해 보고 싶습니다.

sudo chown mysql.mysql -R /usr/local/mysql/data

Debian Linux를 실행하는 경우:

이 문제에 대한 해결책은 mysql.innodb_table_stats 파일을 삭제하고 연관된 .frm 및 .ibd 파일을 제거한 후 다음을 실행했습니다.

dpkg-reconfigure mariadb-server-10.1

innodb_* 테이블을 다시 만들어 주지만 어떤 이유로 (이전 설치에서) 이미 있는 파일로 실행하는 데 문제가 있었습니다.

위의 답변이 작성된 이후로 열과 이름이 변경되었을 수도 있기 때문에 이것이 더 안전하다고 생각합니다.

언급URL : https://stackoverflow.com/questions/15767652/mysql-error-table-mysql-innodb-table-stats-not-found

반응형