今天在Redhat7下面安装MySQL,接下来进行启动MySQL
启动结果如下:
[[email protected] 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默认的日志路径是:
[[email protected] log]# pwd /var/log
查看日志内容:
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
根据日志信息分析,说是有一个参数错误,那么我们就可以进行参数配置检查
参数信息为:
[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
时间: 2024-10-18 15:01:11