最近我在我的 mysql 配置中更改了一些设置。我做了以下操作: - 停止 mysql - 保存更改的设置 - 删除所有 ibdata 和 ib_logfiles - 启动 mysql
通常这工作正常,但最近,每次我这样做时,我所有的 InnoDB 表都会被破坏。我究竟做错了什么?
我的设置:
# The MySQL server
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
thread_cache = 16
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
#skip-networking
server-id = 1
# Uncomment the following if you want to log updates
#log-bin=mysql-bin
# Uncomment the following if you are NOT using BDB tables
skip-bdb
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /var/lib/mysql/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql/
innodb_log_arch_dir = /var/lib/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 400M
innodb_additional_mem_pool_size = 30M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 400M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 0
innodb_lock_wait_timeout = 50
[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 = 8M
sort_buffer_size = 8M
[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M
[mysqlhotcopy]
interactive-timeout
Run Code Online (Sandbox Code Playgroud)
小智 6
你想阅读 mysql.com 文档的最后一段来调整日志文件的大小http://dev.mysql.com/doc/refman/5.1/en/innodb-data-log-reconfiguration.html - 你只需要删除 ib_ 日志文件而不是 ibdata1 文件
停止 MySQL 服务器并确保它关闭时没有错误(以确保日志中没有未完成事务的信息)。将旧的日志文件复制到一个安全的地方,以防在关闭期间出现问题并且您需要它们来恢复表空间。从日志文件目录中删除旧的日志文件,编辑my.cnf更改日志文件配置,再次启动MySQL服务器。mysqld 发现启动时不存在 InnoDB 日志文件并创建新的日志文件。