Dev

mysql 지우고 mariadb설치하는 경우

jwstyle 2021. 2. 23. 20:40

ubuntu 20.04를 설치하고나서 mysql을 설치하자마자 어떤 이유때문에 방금 설치한 mysql을 지우고 mariadb를 다시 설치하는 경우(혹은 그 반대)가 생길 수 있다. 이런경우 mysql을 실행하면 다음과 같은 에러를 볼 수 있다.

mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

이 때 /var/log/mysql/error.log를 보면 다음과 같다.

[Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
[ERROR] InnoDB: Invalid flags 0x4800 in ./ibdata1
[ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
[Note] InnoDB: Starting shutdown...
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[Note] Plugin 'FEEDBACK' is disabled.
[ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting

이런경우 (설치하자 마자 지워서 기존 데이터가 없는 경우) 앞서 mysql 또는 mariadb의 기존정보를  삭제해 준다.

root@# rm -rf /var/lib/mysql/*;
root@# mysql_install_db -u mysql;

그리고 mysql을 다시 시작해 주면 해결되는 경우가 있음.