MySQL-mysql_upgrade-エラーが発生しました:サーバー変数をセットアップできません


10

私は公式のDockerイメージ内でMySQL 5.7.11を実行しています。

アップグレードしようとすると、次のエラーが発生します。

mysql_upgrade -uroot -p
password:
Error occurred: Cannot setup server variables.

私は周りを検索しましたが、ヒントは見つかりませんでした。で実行しようとしました--verboseが、うまくいきませんでした。

参考までに、dbを起動したときのログを以下に示します。

db_1  | 2016-02-17T11:23:10.453190Z 0 [ERROR] Incorrect definition of table performance_schema.events_waits_current: expected column 'NESTING_EVENT_TYPE' at position 15 to have type enum('TRANSACTION','STATEMENT','STAGE','WAIT', found type enum('STATEMENT','STAGE','WAIT').
db_1  | 2016-02-17T11:23:10.453233Z 0 [ERROR] Incorrect definition of table performance_schema.events_waits_history: expected column 'NESTING_EVENT_TYPE' at position 15 to have type enum('TRANSACTION','STATEMENT','STAGE','WAIT', found type enum('STATEMENT','STAGE','WAIT').
db_1  | 2016-02-17T11:23:10.453275Z 0 [ERROR] Incorrect definition of table performance_schema.events_waits_history_long: expected column 'NESTING_EVENT_TYPE' at position 15 to have type enum('TRANSACTION','STATEMENT','STAGE','WAIT', found type enum('STATEMENT','STAGE','WAIT').
db_1  | 2016-02-17T11:23:10.453411Z 0 [ERROR] Incorrect definition of table performance_schema.events_waits_summary_by_user_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16).
db_1  | 2016-02-17T11:23:10.453451Z 0 [ERROR] Incorrect definition of table performance_schema.events_waits_summary_by_account_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16).
db_1  | 2016-02-17T11:23:10.453799Z 0 [ERROR] Column count of performance_schema.setup_actors is wrong. Expected 5, found 3. Created with MySQL 50626, now running 50711. Please use mysql_upgrade to fix this error.
db_1  | 2016-02-17T11:23:10.453902Z 0 [ERROR] Incorrect definition of table performance_schema.setup_objects: expected column 'OBJECT_TYPE' at position 0 to have type enum('EVENT','FUNCTION','PROCEDURE','TABLE','TRIGGER', found type enum('TABLE').
db_1  | 2016-02-17T11:23:10.454171Z 0 [ERROR] Column count of performance_schema.table_lock_waits_summary_by_table is wrong. Expected 68, found 73. Created with MySQL 50626, now running 50711. Please use mysql_upgrade to fix this error.
db_1  | 2016-02-17T11:23:10.454237Z 0 [ERROR] Column count of performance_schema.threads is wrong. Expected 17, found 14. Created with MySQL 50626, now running 50711. Please use mysql_upgrade to fix this error.
db_1  | 2016-02-17T11:23:10.454316Z 0 [ERROR] Column count of performance_schema.events_stages_current is wrong. Expected 12, found 10. Created with MySQL 50626, now running 50711. Please use mysql_upgrade to fix this error.
db_1  | 2016-02-17T11:23:10.454375Z 0 [ERROR] Column count of performance_schema.events_stages_history is wrong. Expected 12, found 10. Created with MySQL 50626, now running 50711. Please use mysql_upgrade to fix this error.
db_1  | 2016-02-17T11:23:10.454429Z 0 [ERROR] Column count of performance_schema.events_stages_history_long is wrong. Expected 12, found 10. Created with MySQL 50626, now running 50711. Please use mysql_upgrade to fix this error.
db_1  | 2016-02-17T11:23:10.454559Z 0 [ERROR] Incorrect definition of table performance_schema.events_stages_summary_by_account_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16).
db_1  | 2016-02-17T11:23:10.454614Z 0 [ERROR] Incorrect definition of table performance_schema.events_stages_summary_by_user_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16).
db_1  | 2016-02-17T11:23:10.454807Z 0 [ERROR] Column count of performance_schema.events_statements_current is wrong. Expected 41, found 40. Created with MySQL 50626, now running 50711. Please use mysql_upgrade to fix this error.
db_1  | 2016-02-17T11:23:10.454908Z 0 [ERROR] Column count of performance_schema.events_statements_history is wrong. Expected 41, found 40. Created with MySQL 50626, now running 50711. Please use mysql_upgrade to fix this error.
db_1  | 2016-02-17T11:23:10.454983Z 0 [ERROR] Column count of performance_schema.events_statements_history_long is wrong. Expected 41, found 40. Created with MySQL 50626, now running 50711. Please use mysql_upgrade to fix this error.
db_1  | 2016-02-17T11:23:10.455093Z 0 [ERROR] Incorrect definition of table performance_schema.events_statements_summary_by_account_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16).
db_1  | 2016-02-17T11:23:10.455151Z 0 [ERROR] Incorrect definition of table performance_schema.events_statements_summary_by_user_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16).
db_1  | 2016-02-17T11:23:10.455347Z 0 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_program' has the wrong structure
db_1  | 2016-02-17T11:23:10.455367Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_current' has the wrong structure
db_1  | 2016-02-17T11:23:10.455383Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_history' has the wrong structure
db_1  | 2016-02-17T11:23:10.455400Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_history_long' has the wrong structure
db_1  | 2016-02-17T11:23:10.455419Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_thread_by_event_name' has the wrong structure
db_1  | 2016-02-17T11:23:10.455437Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_account_by_event_name' has the wrong structure
db_1  | 2016-02-17T11:23:10.455456Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_user_by_event_name' has the wrong structure
db_1  | 2016-02-17T11:23:10.455474Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_host_by_event_name' has the wrong structure
db_1  | 2016-02-17T11:23:10.455492Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_global_by_event_name' has the wrong structure
db_1  | 2016-02-17T11:23:10.455542Z 0 [ERROR] Incorrect definition of table performance_schema.users: expected column 'USER' at position 0 to have type char(32), found type char(16).
db_1  | 2016-02-17T11:23:10.455591Z 0 [ERROR] Incorrect definition of table performance_schema.accounts: expected column 'USER' at position 0 to have type char(32), found type char(16).
db_1  | 2016-02-17T11:23:10.455916Z 0 [ERROR] Native table 'performance_schema'.'memory_summary_global_by_event_name' has the wrong structure
db_1  | 2016-02-17T11:23:10.455952Z 0 [ERROR] Native table 'performance_schema'.'memory_summary_by_account_by_event_name' has the wrong structure
db_1  | 2016-02-17T11:23:10.455974Z 0 [ERROR] Native table 'performance_schema'.'memory_summary_by_host_by_event_name' has the wrong structure
db_1  | 2016-02-17T11:23:10.455995Z 0 [ERROR] Native table 'performance_schema'.'memory_summary_by_thread_by_event_name' has the wrong structure
db_1  | 2016-02-17T11:23:10.456018Z 0 [ERROR] Native table 'performance_schema'.'memory_summary_by_user_by_event_name' has the wrong structure
db_1  | 2016-02-17T11:23:10.456046Z 0 [ERROR] Native table 'performance_schema'.'table_handles' has the wrong structure
db_1  | 2016-02-17T11:23:10.456075Z 0 [ERROR] Native table 'performance_schema'.'metadata_locks' has the wrong structure
db_1  | 2016-02-17T11:23:10.456095Z 0 [ERROR] Native table 'performance_schema'.'replication_connection_configuration' has the wrong structure
db_1  | 2016-02-17T11:23:10.456109Z 0 [ERROR] Native table 'performance_schema'.'replication_group_members' has the wrong structure
db_1  | 2016-02-17T11:23:10.456122Z 0 [ERROR] Native table 'performance_schema'.'replication_connection_status' has the wrong structure
db_1  | 2016-02-17T11:23:10.456136Z 0 [ERROR] Native table 'performance_schema'.'replication_applier_configuration' has the wrong structure
db_1  | 2016-02-17T11:23:10.456148Z 0 [ERROR] Native table 'performance_schema'.'replication_applier_status' has the wrong structure
db_1  | 2016-02-17T11:23:10.456163Z 0 [ERROR] Native table 'performance_schema'.'replication_applier_status_by_coordinator' has the wrong structure
db_1  | 2016-02-17T11:23:10.456176Z 0 [ERROR] Native table 'performance_schema'.'replication_applier_status_by_worker' has the wrong structure
db_1  | 2016-02-17T11:23:10.456190Z 0 [ERROR] Native table 'performance_schema'.'replication_group_member_stats' has the wrong structure
db_1  | 2016-02-17T11:23:10.456202Z 0 [ERROR] Native table 'performance_schema'.'prepared_statements_instances' has the wrong structure
db_1  | 2016-02-17T11:23:10.456217Z 0 [ERROR] Native table 'performance_schema'.'user_variables_by_thread' has the wrong structure
db_1  | 2016-02-17T11:23:10.456229Z 0 [ERROR] Native table 'performance_schema'.'status_by_account' has the wrong structure
db_1  | 2016-02-17T11:23:10.456244Z 0 [ERROR] Native table 'performance_schema'.'status_by_host' has the wrong structure
db_1  | 2016-02-17T11:23:10.456261Z 0 [ERROR] Native table 'performance_schema'.'status_by_thread' has the wrong structure
db_1  | 2016-02-17T11:23:10.456274Z 0 [ERROR] Native table 'performance_schema'.'status_by_user' has the wrong structure
db_1  | 2016-02-17T11:23:10.456287Z 0 [ERROR] Native table 'performance_schema'.'global_status' has the wrong structure
db_1  | 2016-02-17T11:23:10.456299Z 0 [ERROR] Native table 'performance_schema'.'session_status' has the wrong structure
db_1  | 2016-02-17T11:23:10.456311Z 0 [ERROR] Native table 'performance_schema'.'variables_by_thread' has the wrong structure
db_1  | 2016-02-17T11:23:10.456325Z 0 [ERROR] Native table 'performance_schema'.'global_variables' has the wrong structure
db_1  | 2016-02-17T11:23:10.456339Z 0 [ERROR] Native table 'performance_schema'.'session_variables' has the wrong structure
db_1  | 2016-02-17T11:23:10.456385Z 0 [ERROR] Incorrect definition of table mysql.db: expected column 'User' at position 2 to have type char(32), found type char(16).
db_1  | 2016-02-17T11:23:10.456395Z 0 [ERROR] mysql.user has no `Event_priv` column at position 28
db_1  | 2016-02-17T11:23:10.456488Z 0 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
db_1  | 2016-02-17T11:23:10.456574Z 0 [Note] mysqld: ready for connections.
db_1  | Version: '5.7.11'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)

どのバージョンから?
リックジェームズ

あなたはログで見ることができます:Created with MySQL 50626, now running 50711.
ピエールOzoux



1
私の場合、アクセス権のないユーザーでアップグレードを試みました。
サミー・ラルビ

回答:


15

回避策を見つけました!

データベースを停止します。それから始めます:

mysqld --skip-grant-tables &

そして、ついにアップグレードを行うことができました:

mysql_upgrade

私は持ってCould not create unix socket lock file /var/run/mysqld/mysqld.sock.lock作成され、最初のエラーを/var/run/mysqld、次にchown mysql:mysql /var/run/mysqldMySQLを開始してからmysql_upgrade働いていました。
endo64

0

apt-getDockerイメージ内ではなく、基本的なUbuntu 16.04 EC2インスタンスを使用して5.7.xから5.7.15にアップグレードするときに、同様の問題が発生しました。

.mylogin.cnfLinuxのrootユーザーアカウントのファイルを設定して、ユーザー名とパスワードを入力せずにログインできるようmysql_upgradeにし、rootアカウントにログインしているときにコマンドを実行することで、なんとか乗り越えました。

これにより、必要なシステムテーブルのアップグレードが実行され、apt-get upgrade問題なくコマンドを完了することができました。


0

私の場合は

mv /var/lib/mysql /var/lib/mysql.bak

新しい/ var / lib / mysqlフォルダーを、基本的なmysqlデータベースだけが存在するフォルダーにコピーします。私はたまたま/ var / lib / mysql-newに保存しました

mv /var/lib/mysql-new /var/lib/mysql
service mysql restart

apt-get install -f

mysqlデータベースを通過してアップグレードした後、次のことができます。

 mv /var/lib/mysql /var/lib/mysql-new
 mv /var/lib/mysql.bak /var/lib/mysql
 service mysql restart

私のために働いた。パージ、すべての削除、最初からやり直す、apparmorで遊ぶなど、他にもたくさんの提案を試しましたが、これが唯一の方法でした。


0

私の場合、同じ問題がこのように解決されました:

$ mysql_upgrade db_username@db_host -p
Enter password:
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.

StackExchangeサイトへようこそ。他の専門家が理解できるように、常にコードとともに説明を書き留めてください。
Md Haidar Ali Khan、
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.