mysql 5.6 在 redhat 6.4 服务器启动时不会自动启动,但在手动运行“service mysql start”时会启动

mysql 5.6 在 redhat 6.4 服务器启动时不会自动启动,但在手动运行“service mysql start”时会启动

我尝试将 mysql 设置为自动启动但没有成功(RHEL6.4 上的 mysql 5.6)当我在服务器(redhat)重启后运行“service --status-all”时,它总是显示“MySQL 未运行,但锁定文件/var/lock/subsys/mysqld[FAILED]

如果我手动运行service mysql restart\start它就会起作用。

我将 mysql 添加到 chkconfig 如下: chkconfig --add mysql chkconfig mysql on

[root@istahuins09 ~]# chkconfig mysql --list
mysql           0:off   1:off   2:on    3:on    4:on    5:on    6:off

我还尝试使用 --del chkconfig --del mysql 删除并再次添加到 chkconfig

service mysql status

显示:MySQL 未运行,但锁定文件(/var/lock/subsys/mysql[FAILED]

我尝试从头开始重新安装(redhat 和 mysql),并在全新安装后:

  1. 服务 mysql 不起作用(手动和自动)。
  2. 我重新创建 /etc/init.d/mysql 作为 mysql.server 的链接,现在服务可以手动启动了。
  3. 服务器启动后该服务仍然拒绝启动。

my.cnf: # 性能配置 [client]
default-character-set = utf8 socket = /fs0/mysql/instance/1/run/mysql.sock

[mysql]                                  
default-character-set                   = utf8 
socket                                  = /fs0/mysql/instance/1/run/mysql.sock

[mysqld]                                 
user                                    = mysql

port                                    = 3306
default_storage_engine                  = InnoDB


# FILE LOCATION #                        
#basedir                                 = /usr
datadir                                 = /fs0/mysql/instance/1/data
tmpdir                                  = /fs0/mysql/instance/1/tmp
socket                                  = /fs0/mysql/instance/1/run/mysql.sock
pid-file                                = /fs0/mysql/instance/1/run/mysql.pid

log-error                               = /fs0/mysql/instance/1/log/mysql.log

slow_query_log_file                     = /fs0/mysql/instance/1/log/slow_queries.log

log_bin                                 = /fs0/mysql/instance/1/binlog/binlog
log_bin_index                           = /fs0/mysql/instance/1/binlog/binlog.index
relay-log                               = /fs0/mysql/instance/1/relay/relay.log
relay-log-index                         = /fs0/mysql/instance/1/relay/relay.index
relay-log-info-file                     = /fs0/mysql/instance/1/relay/relay.info
master-info-file                        = /fs0/mysql/instance/1/relay/master.info

innodb_data_home_dir                    = /fs0/mysql/instance/1/data
innodb_log_group_home_dir               = /fs0/mysql/instance/1/binlog

# MyISAM #                               
key_buffer_size                         = 32M
myisam_recover                          = FORCE,BACKUP


# SAFETY #                               
max_allowed_packet                      = 16M
max_connect_errors                      = 1000000
sysdate_is_now                          = 1
innodb                                  = FORCE
innodb_strict_mode                      = 1

# TUNING #                               
tmp_table_size                          = 128M
max_heap_table_size                     = 128M
query_cache_type                        = 1
query_cache_size                        = 64M
query_cache_limit                       = 4M
max_connections                         = 5000
thread_cache_size                       = 128
open-files-limit                        = 25000
table_definition_cache                  = 2048
table_open_cache                        = 5000
wait_timeout                            = 330
back_log                                = 50
binlog_cache_size                       = 1M
max_binlog_size                         = 50M

sort_buffer_size                        = 4M
join_buffer_size                        = 4M
read_buffer_size                        = 2M
read_rnd_buffer_size                    = 1M


thread_stack                            = 256K




# INNODB #                               
innodb_flush_method                     = O_DIRECT
innodb_buffer_pool_size                 = 3G
innodb_buffer_pool_instances        = 10
innodb_file_per_table                   = 1
innodb_flush_log_at_trx_commit          = 2
innodb_log_file_size                    = 128M
innodb_log_files_in_group               = 2
innodb_status_file                      = 1
innodb_thread_concurrency               = 10
innodb_lock_wait_timeout                = 90
innodb_log_buffer_size                  = 32M
innodb_max_dirty_pages_pct              = 75
innodb_additional_mem_pool_size         = 512M
innodb_autoextend_increment             = 32
innodb_purge_threads            = 1
innodb_open_files           = 5000


# LOGGING #                              
log-queries-not-using-indexes           = 1
slow-query-log                          = 1
long_query_time                         = 3
log-warnings                            = 2



log-slave-updates                        

# GENERAL #                              

lower_case_table_names                  = 1
skip_external_locking                   = 1
character-set-server                    = utf8
collation-server                        = utf8_unicode_ci
log_bin_trust_function_creators     = TRUE

# PERFROMANCE SCHEMA                     
performance_schema                      = ON

mysql.log:

140507 10:49:11 mysqld_safe Starting mysqld daemon with databases from /fs0/mysql/instance/1/data
2014-05-07 10:49:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-05-07 10:49:16 11401 [Note] Plugin 'FEDERATED' is disabled.
2014-05-07 10:49:16 7f669f48a720 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2014-05-07 10:49:16 11401 [Note] InnoDB: The InnoDB memory heap is disabled
2014-05-07 10:49:16 11401 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-05-07 10:49:16 11401 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-05-07 10:49:16 11401 [Note] InnoDB: Using Linux native AIO
2014-05-07 10:49:16 11401 [Note] InnoDB: Using CPU crc32 instructions
2014-05-07 10:49:16 11401 [Note] InnoDB: Initializing buffer pool, size = 3.0G
2014-05-07 10:49:17 11401 [Note] InnoDB: Completed initialization of buffer pool
2014-05-07 10:49:17 11401 [Note] InnoDB: Highest supported file format is Barracuda.
2014-05-07 10:49:17 11401 [Note] InnoDB: 128 rollback segment(s) are active.
2014-05-07 10:49:17 11401 [Note] InnoDB: Waiting for purge to start
2014-05-07 10:49:17 11401 [Note] InnoDB: 5.6.12 started; log sequence number 1626143
2014-05-07 10:49:17 11401 [Note] Server hostname (bind-address): '*'; port: 3306
2014-05-07 10:49:17 11401 [Note] IPv6 is available.
2014-05-07 10:49:17 11401 [Note]   - '::' resolves to '::';
2014-05-07 10:49:17 11401 [Note] Server socket created on IP: '::'.
2014-05-07 10:49:18 11401 [Note] Event Scheduler: Loaded 0 events
2014-05-07 10:49:18 11401 [Note] /usr/sbin/mysqld: ready for connections.

版本:'5.6.12-log' 套接字:'/fs0/mysql/instance/1/run/mysql.sock' 端口:3306 MySQL 社区服务器 (GPL) 2014-05-07 10:49:48 11401 [注意] /usr/sbin/mysqld: 正常关闭

2014-05-07 10:49:48 11401 [Note] Giving 0 client threads a chance to die gracefully
2014-05-07 10:49:48 11401 [Note] Event Scheduler: Purging the queue. 0 events
2014-05-07 10:49:48 11401 [Note] Shutting down slave threads
2014-05-07 10:49:48 11401 [Note] Forcefully disconnecting 0 remaining clients
2014-05-07 10:49:48 11401 [Note] Binlog end
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'partition'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'ARCHIVE'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'BLACKHOLE'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_METRICS'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_CMPMEM'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_CMP'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_LOCKS'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'INNODB_TRX'
2014-05-07 10:49:48 11401 [Note] Shutting down plugin 'InnoDB'
2014-05-07 10:49:48 11401 [Note] InnoDB: FTS optimize thread exiting.
2014-05-07 10:49:48 11401 [Note] InnoDB: Starting shutdown...
2014-05-07 10:49:49 11401 [Note] InnoDB: Shutdown completed; log sequence number 1626153
2014-05-07 10:49:49 11401 [Note] Shutting down plugin 'MRG_MYISAM'
2014-05-07 10:49:49 11401 [Note] Shutting down plugin 'CSV'
2014-05-07 10:49:49 11401 [Note] Shutting down plugin 'MEMORY'
2014-05-07 10:49:49 11401 [Note] Shutting down plugin 'MyISAM'
2014-05-07 10:49:49 11401 [Note] Shutting down plugin 'sha256_password'
2014-05-07 10:49:49 11401 [Note] Shutting down plugin 'mysql_old_password'
2014-05-07 10:49:49 11401 [Note] Shutting down plugin 'mysql_native_password'
2014-05-07 10:49:49 11401 [Note] Shutting down plugin 'binlog'
2014-05-07 10:49:49 11401 [Note] /usr/sbin/mysqld: Shutdown complete

答案1

您需要配置名为 mysqld 的守护进程。您正在尝试将客户端配置为在启动时作为守护进程运行。

chkconfig mysqld on

service mysqld start

相关内容