好吧,我一直在尝试将 MySQL 5.5 升级到 5.6。我已经得到了这套 my.cnf 文件(见下文)。我能够卸载 MySQL 5.5 rpm 并安装 5.6。当我重新加载备份 my.cnf 文件时,mysql 服务器不想启动。这个文件有问题吗?我已经跑了mysql_install_db
。但是,我无法让服务器使用我的文件启动my.cnf
。我查看了错误日志,但它没有复制任何最近的内容。my.cnf
空白时有效。
这就是我的my.cnf
MySQL 5.5 文件的样子(见下文)。我需要这个 my.cnf 文件才能在 5.6 版本上工作。有人有煽动吗?
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /u02/mysqldata1/mysqld_3306.sock
#
#
[mysqld_safe]
socket = /u02/mysqldata1/mysqld_3306.sock
nice = 0
#
#
[mysqld]
#performance_schema=1
user = mysql
socket = /u02/mysqldata1/mysqld_3306.sock
port = 3306
basedir = /usr
datadir = /u02/mysqldata1/data/3306
tmpdir = /u02/mysqldata/tmp
skip-external-locking
character_set_server = utf8
lower_case_table_names = 1
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address = 0.0.0.0
max_allowed_packet = 64M
max_connections = 500
max_connect_errors = 100
max_heap_table_size = 256M
tmp_table_size = 256M
net_buffer_length = 8K
sort_buffer_size = 4M
read_buffer_size = 1M
read-rnd-buffer-size = 2M
table_cache = 1024
table-definition-cache = 512
thread_stack = 256K
thread_cache_size = 256
sql-mode = NO_AUTO_CREATE_USER
query_cache_size = 64M
query_cache_limit = 4M
#
# MyISAM Configuration
#
key_buffer_size = 512M
myisam_sort_buffer_size = 128M
ft_min_word_len = 3
myisam_recover_options = BACKUP,FORCE
myisam_repair_threads = 6
myisam_use_mmap = 1
#
# General Logging
#
log_error = /u02/mysqldata/mysqllog/3306/err/error.log
long_query_time = 1
slow_query_log = 1
slow_query_log_file = /u02/mysqldata/mysqllog/3306/slow/mysql_slow.log
general_log = 0
general_log_file = /u02/mysqldata/mysqllog/3306/general/mysql_general.log
#
# Binary Log and Replication Configuration
#
log_bin = /u02/mysqldata/mysqllog/3306/bin/mysql-bin.log
log-bin-index = /u02/mysqldata/mysqllog/3306/bin/mysql_bin.index
binlog-cache-size = 256K
binlog_format = ROW
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
relay-log = /u02/mysqldata/mysqllog/3306/relay/mysql_bin.log
relay-log-index = /u02/mysqldata/mysqllog/3306/relay/mysql_bin.index
expire-logs-days = 7
max_binlog_size = 100M
sync_binlog = 0
#
# Replication
#
server-id=129206
#log-slave-updates
#replicate-ignore-db = mysql
#replicate-ignore-table=
slave_transaction_retries = 20
#slave-skip-errors = 1062
#auto_increment_increment = 3
#auto_increment_offset = 3
#
# InnoDB Configuration
#
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
innodb_data_home_dir = /u02/mysqldata1/innodb/3306/data
innodb_log_group_home_dir = /u02/mysqldata1/innodb/3306/log
innodb_file_per_table
innodb_data_file_path = ibdata1:10M:autoextend
transaction-isolation = READ-COMMITTED
innodb_flush_log_at_trx_commit = 0
innodb_log_buffer_size = 8M
innodb_log_file_size = 512M
innodb_buffer_pool_size = 500M
innodb_additional_mem_pool_size = 128M
innodb_flush_method = O_DSYNC
innodb_thread_concurrency = 0
innodb_lock_wait_timeout = 60
innodb-open-files = 500
innodb-support-xa = 0
#
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
[mysqldump]
quick
quote-names
max_allowed_packet = 128M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 1G
答案1
您的服务器有多少 RAM?在大多数 InnoDB 数据库上,500M 对于键缓冲区大小来说太高了。我一般从32M开始。如果设置为 0,则无法运行 MySQL。
如果 innodb_buffer_size + key_buffer_size = > RAM 那么你就会遇到问题。
另外,我通常需要在安全网络中进行此设置:bind-address = 0.0.0.0
my.cnf 的一个很好的起点是:https://tools.percona.com/wizard
答案2
我认为你需要注释掉 my.ini 中的这两行
表缓存和最大连接
希望有帮助。