MySQL 설치가 오류로 인해 중단됩니다.

MySQL 설치가 오류로 인해 중단됩니다.

Raspbian Jessie에 MySQL을 설치하려고 합니다. 이는 동일한 설정을 사용하는 다른 컴퓨터에서도 원활하게 작동했습니다. 그러나 두 번째에서는 작동하지 않습니다.

패키지를 구성하는 동안 비밀번호를 묻는 메시지가 표시되고 잠시 기다린 후 다음 메시지가 표시됩니다.

┌─────────────────────────────────────┤ Configuring mysql-server-5.5 ├──────────────────────────────────────┐    
│                                                                                                           │    
│ Unable to set password for the MySQL "root" user                                                          │    
│                                                                                                           │    
│ An error occurred while setting the password for the MySQL administrative user. This may have happened    │    
│ because the account already has a password, or because of a communication problem with the MySQL server.  │    
│                                                                                                           │    
│ You should check the account's password after the package installation.                                   │    
│                                                                                                           │    
│ Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more information.                  │    
│                                                                                                           │    
│                                                  <Ok>                                                     │    
│                                                                                                           │    
└───────────────────────────────────────────────────────────────────────────────────────────────────────────┘    

좀 더 자세히 살펴보니 이 오류는 MySQL 시작 실패로 인해 발생했다는 것을 알게 되었습니다. 나는 /var/log/mysql/error.log다음과 같은 항목이 있는 을(를) 조사했습니다.

161217 23:33:16 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
161217 23:33:16 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
161217 23:33:17 [Note] /usr/sbin/mysqld (mysqld 5.5.53-0+deb8u1) starting as process 16476 ...
161217 23:33:17 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
161217 23:33:17 [Note] Plugin 'FEDERATED' is disabled.
161217 23:33:17 InnoDB: The InnoDB memory heap is disabled
161217 23:33:17 InnoDB: Mutexes and rw_locks use GCC atomic builtins
161217 23:33:17 InnoDB: Compressed tables use zlib 1.2.8
161217 23:33:17 InnoDB: Using Linux native AIO
161217 23:33:17 InnoDB: Initializing buffer pool, size = 128.0M
161217 23:33:17 InnoDB: Completed initialization of buffer pool
InnoDB: Error: auto-extending data file ./ibdata1 is of a different size
InnoDB: 0 pages (rounded down to MB) than specified in the .cnf file:
InnoDB: initial 640 pages, max 0 (relevant if non-zero) pages!
161217 23:33:17 InnoDB: Could not open or create data files.
161217 23:33:17 InnoDB: If you tried to add new data files, and it failed here,
161217 23:33:17 InnoDB: you should now edit innodb_data_file_path in my.cnf back
161217 23:33:17 InnoDB: to what it was, and remove the new ibdata files InnoDB created
161217 23:33:17 InnoDB: in this failed attempt. InnoDB only wrote those files full of
161217 23:33:17 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
161217 23:33:17 InnoDB: remove old data files which contain your precious data!
161217 23:33:17 [ERROR] Plugin 'InnoDB' init function returned error.
161217 23:33:17 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
161217 23:33:17 [ERROR] Unknown/unsupported storage engine: InnoDB
161217 23:33:17 [ERROR] Aborting

161217 23:33:17 [Note] /usr/sbin/mysqld: Shutdown complete

161217 23:33:18 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

이것은 업그레이드가 아니라 새로 설치하는 것입니다(그 외에는 MySQL 설치를 몇 번 mysql-server-5.5시도하고 사이에 제거를 시도했습니다).

그러나 첫 번째 시도에서 저장 공간이 부족하다는 점을 언급하고 싶습니다(루트 파티션은 2GB 미만이었습니다). 2GB SD 카드를 16GB 카드로 교체하고, dd이전 것의 내용을 새 것으로 '넣고' 파티션을 확장하여 이 문제를 해결해 보았습니다. 그래도 작동할 수 없습니다. 반면 첫 번째 시스템(처음부터 4GB 카드가 있음)은 제대로 작동했습니다. 여기서 문제는 무엇이며 어떻게 해결할 수 있습니까?

답변1

분명히 이 문제는 첫 번째 시도에서 저장 공간 부족으로 인해 발생했습니다. MySQL은 공간 부족으로 인해 실패하고 손상된 데이터 파일과 이를 가리키는 구성 파일을 남겨둔 데이터 파일 생성을 시도했습니다.

IIRC의 첫 번째 시도는 MySQL을 다시 설치하는 것이었고 sudo apt-get remove, 이로 인해 잘못된 데이터 파일과 구성이 남겨졌기 때문에 다음 설치에서도 이를 선택하고 동일한 방식으로 실패했습니다.

분명히 후속 항목조차도 sudo apt-get purge mysql-server-5.5이러한 항목을 제거하지 않았습니다. 다음 명령 시퀀스가 ​​마침내 나에게 도움이 되었습니다.

sudo apt-get purge mysql-server-5.5
sudo rm -R /etc/mysql
sudo rm -R /var/lib/mysql
sudo apt-get install mysql-server

그 후 MySQL이 등장했고 MySQL 콘솔에 로그인할 수 있었습니다.

중요: 이렇게 하면 시스템의 모든 MySQL 데이터가 영구적으로 삭제됩니다. 새로 설치하거나 결과를 알고 있는 경우에만 이 작업을 수행하십시오.

관련 정보