我已经在CentOS6.9中将mysql 5.1升级到mysql 5.7。但是现在当我尝试启动mysql时,mysql无法启动
文件权限:
[root@Intern mysql]# ll /var/lib/mysql
total 174104
-rw-r----- 1 mysql mysql 56 Jun 25 14:35 auto.cnf
drwx------.2 mysql mysql 4096 Jun 21 18:35 aysha
-rw-r----- 1 mysql mysql 176 Jun 25 16:15 ib_buffer_pool
-rw-rw----.1 mysql mysql 77594624 Jun 25 16:15 ibdata1
-rw-r----- 1 mysql mysql 50331648 Jun 25 16:15 ib_logfile0
-rw-r----- 1 mysql mysql 50331648 Jun 25 14:35 ib_logfile1
drwx------.2 mysql mysql 4096 May 3 04:01 mysql
drwx------.2 mysql mysql 4096 Jun 20 16:20 onny
mysql日志文件很长。我分享最后一部分
2018-06-25T08:13:11.075734Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.22) starting as process 17051 ...
2018-06-25T08:13:11.084772Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-06-25T08:13:11.084836Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-25T08:13:11.084853Z 0 [Note] InnoDB: Uses event mutexes
2018-06-25T08:13:11.084869Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2018-06-25T08:13:11.084884Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-06-25T08:13:11.084899Z 0 [Note] InnoDB: Using Linux native AIO
2018-06-25T08:13:11.085500Z 0 [Note] InnoDB: Number of pools: 1
2018-06-25T08:13:11.085743Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-06-25T08:13:11.088788Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-06-25T08:13:11.108147Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-06-25T08:13:11.112451Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-06-25T08:13:11.125959Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-06-25T08:13:11.146961Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-06-25T08:13:11.147109Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-06-25T08:13:11.383445Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-06-25T08:13:11.385856Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-06-25T08:13:11.385897Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-06-25T08:13:11.386518Z 0 [Note] InnoDB: Waiting for purge to start
2018-06-25T08:13:11.436825Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 1252440
2018-06-25T08:13:11.437235Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-06-25T08:13:11.440536Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-06-25T08:13:11.440907Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180625 17:13:11
2018-06-25T08:13:11.446243Z 0 [Warning] System table 'plugin' is expected to be transactional.
2018-06-25T08:13:11.447765Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-06-25T08:13:11.447981Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2018-06-25T08:13:11.448523Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2018-06-25T08:13:11.448624Z 0 [Note] IPv6 is available.
2018-06-25T08:13:11.448654Z 0 [Note] - '::' resolves to '::';
2018-06-25T08:13:11.448728Z 0 [Note] Server socket created on IP: '::'.
2018-06-25T08:13:11.457839Z 0 [Warning] Failed to open optimizer cost constant tables
2018-06-25T08:13:11.458554Z 0 [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
2018-06-25T08:13:11.458689Z 0 [ERROR] Aborting
2018-06-25T08:13:11.459462Z 0 [Note] Binlog end
2018-06-25T08:13:11.459626Z 0 [Note] Shutting down plugin 'ngram'
2018-06-25T08:13:11.459662Z 0 [Note] Shutting down plugin 'partition'
2018-06-25T08:13:11.459678Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2018-06-25T08:13:11.459694Z 0 [Note] Shutting down plugin 'ARCHIVE'
2018-06-25T08:13:11.459708Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2018-06-25T08:13:11.459723Z 0 [Note] Shutting down plugin 'MEMORY'
2018-06-25T08:13:11.459743Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2018-06-25T08:13:11.459758Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2018-06-25T08:13:11.459772Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2018-06-25T08:13:11.459785Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2018-06-25T08:13:11.459799Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2018-06-25T08:13:11.459812Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2018-06-25T08:13:11.459826Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2018-06-25T08:13:11.459839Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2018-06-25T08:13:11.459852Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2018-06-25T08:13:11.459866Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2018-06-25T08:13:11.459879Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2018-06-25T08:13:11.459892Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2018-06-25T08:13:11.459905Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2018-06-25T08:13:11.459919Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2018-06-25T08:13:11.459932Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2018-06-25T08:13:11.459946Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2018-06-25T08:13:11.459960Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2018-06-25T08:13:11.459973Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2018-06-25T08:13:11.459986Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2018-06-25T08:13:11.460000Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2018-06-25T08:13:11.460013Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2018-06-25T08:13:11.460027Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2018-06-25T08:13:11.460040Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2018-06-25T08:13:11.460054Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2018-06-25T08:13:11.460068Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2018-06-25T08:13:11.460093Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2018-06-25T08:13:11.460107Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2018-06-25T08:13:11.460120Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2018-06-25T08:13:11.460133Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2018-06-25T08:13:11.460146Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2018-06-25T08:13:11.460159Z 0 [Note] Shutting down plugin 'InnoDB'
2018-06-25T08:13:11.460463Z 0 [Note] InnoDB: FTS optimize thread exiting.
2018-06-25T08:13:11.460707Z 0 [Note] InnoDB: Starting shutdown...
2018-06-25T08:13:11.561129Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2018-06-25T08:13:11.561382Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 180625 17:13:11
2018-06-25T08:13:13.280859Z 0 [Note] InnoDB: Shutdown completed; log sequence number 1252459
2018-06-25T08:13:13.285577Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-06-25T08:13:13.285617Z 0 [Note] Shutting down plugin 'MyISAM'
2018-06-25T08:13:13.285659Z 0 [Note] Shutting down plugin 'CSV'
2018-06-25T08:13:13.285682Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2018-06-25T08:13:13.285904Z 0 [Note] Shutting down plugin 'sha256_password'
2018-06-25T08:13:13.285920Z 0 [Note] Shutting down plugin 'mysql_native_password'
2018-06-25T08:13:13.286258Z 0 [Note] Shutting down plugin 'binlog'
2018-06-25T08:13:13.286691Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
2018-06-25T09:00:44.015540Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-06-25T09:00:44.018750Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.22) starting as process 17711 ...
2018-06-25T09:00:44.027800Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-06-25T09:00:44.027858Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-25T09:00:44.027874Z 0 [Note] InnoDB: Uses event mutexes
2018-06-25T09:00:44.027888Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2018-06-25T09:00:44.027902Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-06-25T09:00:44.027920Z 0 [Note] InnoDB: Using Linux native AIO
2018-06-25T09:00:44.028486Z 0 [Note] InnoDB: Number of pools: 1
2018-06-25T09:00:44.028716Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-06-25T09:00:44.031433Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-06-25T09:00:44.049364Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-06-25T09:00:44.053356Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-06-25T09:00:44.066737Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-06-25T09:00:44.095600Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-06-25T09:00:44.095753Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-06-25T09:00:44.335913Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-06-25T09:00:44.338272Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-06-25T09:00:44.338354Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-06-25T09:00:44.338950Z 0 [Note] InnoDB: Waiting for purge to start
2018-06-25T09:00:44.389239Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 1252459
2018-06-25T09:00:44.389648Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-06-25T09:00:44.394543Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-06-25T09:00:44.394954Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180625 18:00:44
2018-06-25T09:00:44.398896Z 0 [Warning] System table 'plugin' is expected to be transactional.
2018-06-25T09:00:44.400400Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-06-25T09:00:44.400603Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2018-06-25T09:00:44.401130Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2018-06-25T09:00:44.401229Z 0 [Note] IPv6 is available.
2018-06-25T09:00:44.401259Z 0 [Note] - '::' resolves to '::';
2018-06-25T09:00:44.401370Z 0 [Note] Server socket created on IP: '::'.
2018-06-25T09:00:44.410424Z 0 [Warning] Failed to open optimizer cost constant tables
2018-06-25T09:00:44.411463Z 0 [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
2018-06-25T09:00:44.411658Z 0 [ERROR] Aborting
2018-06-25T09:00:44.411758Z 0 [Note] Binlog end
2018-06-25T09:00:44.411905Z 0 [Note] Shutting down plugin 'ngram'
2018-06-25T09:00:44.411939Z 0 [Note] Shutting down plugin 'partition'
2018-06-25T09:00:44.411954Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2018-06-25T09:00:44.411970Z 0 [Note] Shutting down plugin 'ARCHIVE'
2018-06-25T09:00:44.411984Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2018-06-25T09:00:44.411999Z 0 [Note] Shutting down plugin 'MEMORY'
2018-06-25T09:00:44.412018Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2018-06-25T09:00:44.412033Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2018-06-25T09:00:44.412046Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2018-06-25T09:00:44.412059Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2018-06-25T09:00:44.412073Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2018-06-25T09:00:44.412086Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2018-06-25T09:00:44.412099Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2018-06-25T09:00:44.412112Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2018-06-25T09:00:44.412125Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2018-06-25T09:00:44.412138Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2018-06-25T09:00:44.412151Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2018-06-25T09:00:44.412164Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2018-06-25T09:00:44.412177Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2018-06-25T09:00:44.412191Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2018-06-25T09:00:44.412204Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2018-06-25T09:00:44.412217Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2018-06-25T09:00:44.412231Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2018-06-25T09:00:44.412244Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2018-06-25T09:00:44.412257Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2018-06-25T09:00:44.412270Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2018-06-25T09:00:44.412322Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2018-06-25T09:00:44.412337Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2018-06-25T09:00:44.412351Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2018-06-25T09:00:44.412364Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2018-06-25T09:00:44.412377Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2018-06-25T09:00:44.412391Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2018-06-25T09:00:44.412404Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2018-06-25T09:00:44.412417Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2018-06-25T09:00:44.412430Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2018-06-25T09:00:44.412443Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2018-06-25T09:00:44.412456Z 0 [Note] Shutting down plugin 'InnoDB'
2018-06-25T09:00:44.412701Z 0 [Note] InnoDB: FTS optimize thread exiting.
2018-06-25T09:00:44.412956Z 0 [Note] InnoDB: Starting shutdown...
2018-06-25T09:00:44.513424Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2018-06-25T09:00:44.513678Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 180625 18:00:44
2018-06-25T09:00:46.233505Z 0 [Note] InnoDB: Shutdown completed; log sequence number 1252478
2018-06-25T09:00:46.238250Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-06-25T09:00:46.238320Z 0 [Note] Shutting down plugin 'MyISAM'
2018-06-25T09:00:46.238382Z 0 [Note] Shutting down plugin 'CSV'
2018-06-25T09:00:46.238407Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2018-06-25T09:00:46.238628Z 0 [Note] Shutting down plugin 'sha256_password'
2018-06-25T09:00:46.238644Z 0 [Note] Shutting down plugin 'mysql_native_password'
2018-06-25T09:00:46.238981Z 0 [Note] Shutting down plugin 'binlog'
2018-06-25T09:00:46.239403Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
/etc/my.cnf
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
答案1
这应该可以解决问题:
2018-06-25T08:13:11.458554Z 0 [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
所以请运行mysql_upgrade
,然后执行service mysqld start