먼저 아래 로그 예제는 MySQL 버전이 서로 다른 서버 사이에서 데이터베이스 파일을 그대로 옮겨서 사용할 때 발생한 것이다.
Aug 2 12:02:47 wiz-1 mysqld: 100802 12:02:47 [ERROR] Column count of mysql.db is wrong. Expected 22, found 20. Created with MySQL 50075, now running 50137. Please use mysql_upgrade to fix this error.
Aug 2 12:02:47 wiz-1 mysqld: 100802 12:02:47 [ERROR] mysql.user has no `Event_priv` column at position 29
Aug 2 12:02:47 wiz-1 mysqld: 100802 12:02:47 [ERROR] Cannot open mysql.event
Aug 2 12:02:47 wiz-1 mysqld: 100802 12:02:47 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
기존 서버의 MySQL 버전에서는 mysql.user 테이블에 Event_priv 필드가 없었는데, 새로운 버전에서 추가되어서 문제가 생긴것이다.
그래서 아래와 같이 mysql_upgrade를 사용해서 자동으로 교정을 해준다. 이때 MySQL 서버는 운영 중인 상태로 두어야 한다.
mysql_upgrade -u root --password
그리고나서 MySQL 재시작시켜주면 업그레이드된 테이블의 내용이 반영된다.
참고로 MySQL 재시작 과정에서 아래와 같은 에러 로그가 나온다면 debian-sys-maint 사용자를 등록해줘야한다.
Aug 2 13:45:53 wiz-1 /etc/mysql/debian-start[3827]: /usr/bin/mysqlcheck: Got error: 1045: Access denied for user 'debian-sys-maint'@'localhost' (using password: YES) when trying to connect
Aug 2 13:45:53 wiz-1 /etc/mysql/debian-start[3827]: FATAL ERROR: Upgrade failed
먼저 /etc/mysql/debian.cnf 파일에서 mysql-upgrade 영역에 있는 debian-sys-maint 사용자의 패스워드를 복사한다. 이 예제에서는 TEXSvTrT215CxmAx 이다. 그 다음에 MySQL에 root로 접속해서 아래와 같이 사용자를 등록해준다.
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'TEXSvTrT215CxmAx' WITH GRANT OPTION;

comments
comments rss (+댓글 쓰러가기)