Description:
I am setting up a new master and slave server. When enabling the "read-only" option in /etc/my.cnf, the server fails to start.
When starting the server, it reports that it started.
Trying to connect 2 times immediately will produce:
[root@db02 mysql]# mysql
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 104
[root@db02 mysql]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
Commenting out read-only causes the server to function perfectly.
========================================================================
In the error log, you will find:
071213 23:28:17 mysqld_safe mysqld from pid file /var/lib/mysql/mysql.pid ended
071213 23:28:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql/data
071213 23:28:20 [Warning] Although a path was specified for the --log-slow-queries option, log tables are used. To enable logging to files use the --log-output=file option.
071213 23:28:21 InnoDB: Started; log sequence number 0 46410
/usr/sbin/mysqld: File '/var/log/IZRM/mysql-slow.log' not found (Errcode: 13)
071213 23:28:21 [ERROR] Could not use /var/log/IZRM/mysql-slow.log for logging (error 13). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.
071213 23:28:21 [ERROR] Event Scheduler: Failed to open table mysql.event
071213 23:28:21 [ERROR] Event Scheduler: Error while loading from disk.
071213 23:28:21 [Note] Event Scheduler: Purging the queue. 0 events
071213 23:28:21 [ERROR] Aborting
071213 23:28:21 InnoDB: Starting shutdown...
071213 23:28:23 InnoDB: Shutdown completed; log sequence number 0 46410
071213 23:28:23 [Note] /usr/sbin/mysqld: Shutdown complete
071213 23:28:23 mysqld_safe mysqld from pid file /var/lib/mysql/mysql.pid ended
How to repeat:
Here is my my.cnf:
###########################################################################################
# MYSQL CLIENT CONFIGURATION
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock
############################################################################################
# THE MYSQL SERVER CONFIGURATION
[mysqld]
# Server Settings
port = 3306
socket = /var/lib/mysql/mysql.sock
pid-file = /var/lib/mysql/mysql.pid
datadir = /var/lib/mysql/data
# Limits
max_allowed_packet = 2M
# Other Settings
skip-external-locking
# Buffers / Memory / Threads
key_buffer = 1536M
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache = 8
thread_concurrency = 8
# Query Cache
query_cache_size = 32M
query_cache_type = 1
# Slow Query Log
log_slow_queries = /var/log/IZRM/mysql-slow.log
long_query_time = 1
# General Query Log - ONLY ENABLE FOR SERVER TESTING/INSPECTION
#log = /var/lib/mysql/log/general.log
# Error Log
log-error = /var/log/IZRM/mysql-error.log
# Replication Master Server (default)
# binary logging is required for replication
log-bin = /var/lib/mysql/log_bin/binlog
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1002
read-only
##########################################################################################
# INNODB CONFIGURATION
# Data and log paths
innodb_data_home_dir = /var/lib/mysql/data_innodb
innodb_data_file_path = ibdata1:2000M:autoextend
innodb_log_group_home_dir = /var/lib/mysql/data_innodb
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 1024M
innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_lock_wait_timeout = 50
# as per http://dev.mysql.com/doc/refman/5.1/en/replication-howto-masterbaseconfig.html
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
##########################################################################################
# MISCELLANEOUS CONFIGURATION
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout