2015-02-14 13 views
5

MySQL (Percona 5.6) non verrà avviato.Errore irreversibile di MySQL: Impossibile aprire e bloccare le tabelle dei privilegi: Formato file errato 'utente'

Questo errore mi è successo diverse volte. Ogni volta, ho dovuto rimuovere le directory dei dati MySQL e reinstallare MySQL.

C'è un altro modo per risolvere MySQL? (In particolare uno in cui i dati non spazzato via?)

/var/log/mysql/error.log

150214 16:36:39 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 
2015-02-14 16:36:40 0 [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. 
2015-02-14 16:36:40 0 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release. 
2015-02-14 16:36:40 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2015-02-14 16:36:40 1018 [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. 
2015-02-14 16:36:40 1018 [Note] Plugin 'FEDERATED' is disabled. 
/usr/sbin/mysqld: Incorrect file format 'plugin' 
2015-02-14 16:36:40 1018 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 
2015-02-14 16:36:40 1018 [Note] InnoDB: Using atomics to ref count buffer pool pages 
2015-02-14 16:36:40 1018 [Note] InnoDB: The InnoDB memory heap is disabled 
2015-02-14 16:36:40 1018 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
2015-02-14 16:36:40 1018 [Note] InnoDB: Memory barrier is not used 
2015-02-14 16:36:40 1018 [Note] InnoDB: Compressed tables use zlib 1.2.8 
2015-02-14 16:36:40 1018 [Note] InnoDB: Using Linux native AIO 
2015-02-14 16:36:40 1018 [Note] InnoDB: Using CPU crc32 instructions 
2015-02-14 16:36:40 1018 [Note] InnoDB: Initializing buffer pool, size = 256.0M 
2015-02-14 16:36:40 1018 [Note] InnoDB: Completed initialization of buffer pool 
2015-02-14 16:36:40 1018 [Note] InnoDB: Highest supported file format is Barracuda. 
2015-02-14 16:36:40 1018 [Note] InnoDB: The log sequence numbers 714340126 and 714340126 in ibdata files do not match the log sequence number 716513090 in the ib_logfiles! 
2015-02-14 16:36:40 1018 [Note] InnoDB: Database was not shutdown normally! 
2015-02-14 16:36:40 1018 [Note] InnoDB: Starting crash recovery. 
2015-02-14 16:36:40 1018 [Note] InnoDB: Reading tablespace information from the .ibd files... 
2015-02-14 16:36:40 1018 [Note] InnoDB: Restoring possible half-written data pages 
2015-02-14 16:36:40 1018 [Note] InnoDB: from the doublewrite buffer... 
InnoDB: Last MySQL binlog file position 0 292596, file name binlog.000056 
2015-02-14 16:36:40 1018 [Note] InnoDB: 128 rollback segment(s) are active. 
2015-02-14 16:36:40 1018 [Note] InnoDB: Waiting for purge to start 
2015-02-14 16:36:40 1018 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.21-70.1 started; log sequence number 716513090 
2015-02-14 16:36:40 1018 [Note] Recovering after a crash using binlog 
2015-02-14 16:36:40 1018 [Note] Starting crash recovery... 
2015-02-14 16:36:40 1018 [Note] Crash recovery finished. 
2015-02-14 16:36:40 1018 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work. 
2015-02-14 16:36:40 1018 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work. 
2015-02-14 16:36:40 1018 [Note] Server hostname (bind-address): '*'; port: 3306 
2015-02-14 16:36:40 1018 [Note] IPv6 is available. 
2015-02-14 16:36:40 1018 [Note] - '::' resolves to '::'; 
2015-02-14 16:36:40 1018 [Note] Server socket created on IP: '::'. 
2015-02-14 16:36:40 1018 [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect file format 'user' 
150214 16:36:40 mysqld_safe mysqld from pid file /tmp/mysqld.pid ended 
+1

si può provare a lanciare 'mysql_upgrade' (come suggerito nei registri); o eventualmente 'mysql_install_db' –

+0

Probabilmente hai qualcosa che incasina il tuo pacchetto ... Hai per caso qualcosa che rimpiazza il normale MySQL (vs percona?) e poi torna a percona? Quando lo fai funzionare fai un backup del tuo database "mysql" dovresti riuscire a rimetterlo in questo caso. – ROunofF

risposta

11

sono riuscito così risolvere questo problema con answer from ruby.b

You'll have to repair your host table. To do this, issue the following command to start your server bypassing the privilege system

in un terminale, eseguire

$ sudo mysqld --skip-grant-tables 

Aprire un'altra terminale ed eseguire questi comandi

$ mysql 
mysql> use mysql 
mysql> repair table host use_frm; 
mysql> exit 

e riavviare il servizio mysql

$ sudo service mysql restart 
+0

grazie mille. nel mio caso ho dovuto riparare la tabella utente invece della tabella host così ho fatto: riparazione utente tabella use_frm; invece e ha funzionato! – Rejinderi

3

Grazie a John per avermi messo sulla strada giusta, ho avuto un paio di altri cerchi di saltare attraverso il mio sistema. Spero che questo aiuti qualcuno.

Questa è una tabella dei privilegi corrotta. Forse causato da un aggiornamento o un'interruzione di corrente. Il mio sistema OpenSUSE 13.2, MySQL 5.6. Semplice reinstallazione non risolve, deve eliminare ogni traccia di MySQL prima di reinstallare o ...

chiudere tutte le istanze di MySQL

$ systemctl stop mysql.service 
$ pkill -9 mysqld 

server di Inizio bypassare il sistema di privilegio

$ sudo mysqld_safe --user=root --skip-grant-tables 
strumento

Inizia a riga di comando MySQL

$ mysql 

Se si riceve

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

mysqld_safe è in esecuzione con la sua presa da qualche altra parte. Trovalo con.

$ sudo find/-type s 

Il mio era in/var/run/mysql/ Modifica la linea presa in my.cnf, facendo una nota della vostra impostazione zoccolo attuale. La mia linea è diventata

socket=/var/run/mysql/mysql.sock 

Torna a 'Chiudere tutte le istanze di MySQL' (la parte superiore di queste istruzioni). Seguirli fino a "Avvia lo strumento da riga di comando MySQL". Spero che tu possa aprire mysql con successo. Dalla riga di comando mysql.

mysql> use mysql 
mysql> repair table user use_frm; 
mysql> exit 

chiudere tutte le istanze di MySQL

$ systemctl stop mysql.service 
$ pkill -9 mysqld 

Re-edit my.cnf, restituendo la linea presa alla sua impostazione originale.

Ho dovuto ripristinare le autorizzazioni su 2 file nella mia directory di dati mysql.

$ chown mysql:mysql server2.err 
$ chown mysql:mysql server2.pid 

avviare il server MySQL

$ systemctl start mysql.service 

Allora ho ottenuto lo stesso errore originale con un altro tavolo (db)

[ERROR] Fatal error: Can't open and lock privilege tables: Incorrect file format 'db' 

e ha dovuto ripetere le procedura sopra descritta più volte alterare il ' riparazione 'comando fino a quando tutte le tabelle dei privilegi sono state riparate.

mysql> repair table db use_frm; 
+2

'mysqld_safe --user = root --skip-grant-tables' mi ha salvato la vita !! – russellhoff

Problemi correlati