今天在Redhat7下面安裝MySQL,接下來進行啓動MySQLmysql
啓動結果以下:sql
[root@localhost log]# service mysqld start Redirecting to /bin/systemctl start mysqld.service Job for mysqld.service failed. See 'systemctl status mysqld.service' and 'journalctl -xn' for details.
那麼咱們遇到這樣的錯誤就須要找MySQL啓動日誌,而後進行分析。網絡
MySQL默認的日誌路徑是:socket
[root@localhost log]# pwd
/var/log
查看日誌內容:ui
150806 20:57:06 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 2015-08-06 20:57:06 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2015-08-06 20:57:06 0 [Note] /usr/sbin/mysqld (mysqld 5.6.26) starting as process 12043 ... 2015-08-06 20:57:06 12043 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000) 2015-08-06 20:57:06 12043 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000) 2015-08-06 20:57:06 12043 [Note] Plugin 'FEDERATED' is disabled. 2015-08-06 20:57:06 12043 [Note] InnoDB: Using atomics to ref count buffer pool pages 2015-08-06 20:57:06 12043 [Note] InnoDB: The InnoDB memory heap is disabled 2015-08-06 20:57:06 12043 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2015-08-06 20:57:06 12043 [Note] InnoDB: Memory barrier is not used 2015-08-06 20:57:06 12043 [Note] InnoDB: Compressed tables use zlib 1.2.3 2015-08-06 20:57:06 12043 [Note] InnoDB: Using Linux native AIO 2015-08-06 20:57:06 12043 [Note] InnoDB: Not using CPU crc32 instructions 2015-08-06 20:57:06 12043 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2015-08-06 20:57:06 12043 [Note] InnoDB: Completed initialization of buffer pool 2015-08-06 20:57:06 12043 [Note] InnoDB: Highest supported file format is Barracuda. 2015-08-06 20:57:06 12043 [Note] InnoDB: 128 rollback segment(s) are active. 2015-08-06 20:57:06 12043 [Note] InnoDB: Waiting for purge to start 2015-08-06 20:57:06 12043 [Note] InnoDB: 5.6.26 started; log sequence number 1600617 2015-08-06 20:57:06 12043 [ERROR] /usr/sbin/mysqld: unknown option '--rity risks' ##需額外注重ERROR級別的錯誤信息,此處顯示的是未知的參數—rity risks 2015-08-06 20:57:06 12043 [ERROR] Aborting 2015-08-06 20:57:06 12043 [Note] Binlog end 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'partition' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'ARCHIVE' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_SYS_FIELDS' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_SYS_INDEXES' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_SYS_TABLES' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_FT_CONFIG' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_FT_DELETED' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_METRICS' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_CMPMEM' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_CMP_RESET' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_CMP' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_LOCK_WAITS' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_LOCKS' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'INNODB_TRX' 2015-08-06 20:57:06 12043 [Note] Shutting down plugin 'InnoDB' 2015-08-06 20:57:06 12043 [Note] InnoDB: FTS optimize thread exiting. 2015-08-06 20:57:06 12043 [Note] InnoDB: Starting shutdown... 2015-08-06 20:57:08 12043 [Note] InnoDB: Shutdown completed; log sequence number 1600627 2015-08-06 20:57:08 12043 [Note] Shutting down plugin 'BLACKHOLE' 2015-08-06 20:57:08 12043 [Note] Shutting down plugin 'MyISAM' 2015-08-06 20:57:08 12043 [Note] Shutting down plugin 'MEMORY' 2015-08-06 20:57:08 12043 [Note] Shutting down plugin 'CSV' 2015-08-06 20:57:08 12043 [Note] Shutting down plugin 'MRG_MYISAM' 2015-08-06 20:57:08 12043 [Note] Shutting down plugin 'sha256_password' 2015-08-06 20:57:08 12043 [Note] Shutting down plugin 'mysql_old_password' 2015-08-06 20:57:08 12043 [Note] Shutting down plugin 'mysql_native_password' 2015-08-06 20:57:08 12043 [Note] Shutting down plugin 'binlog' 2015-08-06 20:57:08 12043 [Note] /usr/sbin/mysqld: Shutdown complete 150806 20:57:09 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
根據日誌信息分析,說是有一個參數錯誤,那麼咱們就能夠進行參數配置檢查atom
參數信息爲:spa
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted secu rity risks symbolic-links=0 character-set-server=utf8 #設置字符集爲utf8 innodb_file_per_table=1 #讓innodb的每一個表文件單獨存儲 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
經檢查發現有一個參數rity risk配置有誤,因爲參數配置直接從網絡上拷貝,格式存在問題致使多了一個換行符,將其改成下面這樣就行了。日誌
# Disabling symbolic-links is recommended to prevent assorted security risks