mysql安裝/啟動報錯彙總

Jelly_lyj發表於2017-03-18

2016/9/6補充

初始化報錯:

# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysqldb/
Installing MySQL system tables...2016-09-06 17:29:16 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-09-06 17:29:17 0 [Note] /usr/local/mysql//bin/mysqld (mysqld 5.6.32) starting as process 21651 ...
2016-09-06 17:29:19 21651 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-09-06 17:29:19 21651 [Note] InnoDB: The InnoDB memory heap is disabled
2016-09-06 17:29:19 21651 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-09-06 17:29:19 21651 [Note] InnoDB: Memory barrier is not used
2016-09-06 17:29:19 21651 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-09-06 17:29:19 21651 [Note] InnoDB: Using CPU crc32 instructions
/usr/local/mysql//bin/mysqld: Can't create/write to file '/tmp/ibEKTPAP' (Errcode: 13 - Permission denied)
2016-09-06 17:29:19 7f72573f0720  InnoDB: Error: unable to create temporary file; errno: 13
2016-09-06 17:29:19 21651 [ERROR] Plugin 'InnoDB' init function returned error.
2016-09-06 17:29:19 21651 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-09-06 17:29:19 21651 [ERROR] Unknown/unsupported storage engine: InnoDB
2016-09-06 17:29:19 21651 [ERROR] Aborting

2016-09-06 17:29:19 21651 [Note] Binlog end
2016-09-06 17:29:19 21651 [Note] /usr/local/mysql//bin/mysqld: Shutdown complete

解決方法:

# chmod 777 /tmp

 


 

第一次安裝mysql,啟動時報錯

# /etc/init.d/mysqld start
Starting MySQL.......The server quit without updating PID f[失敗]tmp/mysql.pid).

檢視日誌

# tailf /data/mysqldb/log/mysql-error.log
160730 00:57:28 mysqld_safe Starting mysqld daemon with databases from /data/mysqldb
2016-07-30 00:57:29 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.31-log) starting as process 18702 ...
2016-07-30 00:57:29 18702 [Warning] option 'innodb-buffer-pool-instances': signed value -1 adjusted to 0
.........
2016-07-30 00:57:29 18702 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 768 pages (rounded down to MB) than specified in the .cnf file: initial 131072 pages, max 0 (relevant if non-zero) pages!
2016-07-30 00:57:29 18702 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2016-07-30 00:57:29 18702 [ERROR] Plugin 'InnoDB' init function returned error.
2016-07-30 00:57:29 18702 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-07-30 00:57:29 18702 [ERROR] Unknown/unsupported storage engine: InnoDB
2016-07-30 00:57:29 18702 [ERROR] Aborting
......
160730 00:57:29 mysqld_safe mysqld from pid file /tmp/mysql.pid ended

解決方法

# ls /data/mysqldb
binlog  ibdata1  ib_logfile0  ib_logfile1  log  mysql  performance_schema  test

重新命名或者直接刪除這三個檔案
# mv ibdata1 ibdata1.bak
# mv ib_logfile0 ib_logfile0.bak
# mv ib_logfile1 ib_logfile1.bak

# /etc/init.d/mysqld start
Starting MySQL........................                     [確定]

 


之前因為總是斷電,啟動資料庫報如下類似錯誤

# /etc/init.d/mysqld status
MySQL is not running, but lock file (/var/lock/subsys/mysql[失敗]ts

 

檢視日誌

# tailf /data/mysqldb/log/mysql-error.log 
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
160801 19:30:39 mysqld_safe mysqld from pid file /tmp/mysql.pid ended

 

解決方法

同上,刪除那幾個檔案即可

 

相關文章