搞了好几天,虽然只是装了个比较老的版本,但是也算一个小的进步。
准备调整一下InnoDB的参数:
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /opt/mysqldata/data/
innodb_data_file_path = ibdata1:100M;ibdata2:100M:autoextend
innodb_log_group_home_dir = /opt/mysqldata/data/
innodb_log_files_in_group = 3
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 32M
innodb_additional_mem_pool_size = 4M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 16M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
启动时报错:
01225 17:41:01 mysqld_safe Starting mysqld daemon with databases from /opt/mysqldata/data
101225 17:41:01 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use InnoDB's own implementation
InnoDB: Error: data file /opt/mysqldata/data/ibdata1 is of a different size
InnoDB: 640 pages (rounded down to MB)
InnoDB: than specified in the .cnf file 6400 pages!
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
101225 17:41:01 [ERROR] Plugin 'InnoDB' init function returned error.
101225 17:41:01 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
101225 17:41:01 [Note] Event Scheduler: Loaded 0 events
101225 17:41:01 [Note] /opt/mysqldata/libexec/mysqld: ready for connections.
Version: '5.1.45-log' socket: '/opt/mysqldata/mysql.sock' port: 3306 Source distribution
原因是我的参数文件是cp support-files/my-small.cnf /etc/my.cnf,启动后mysql自动建立表空间数据文件和重做日志文件,修改参数后再次启动就会这样。
对于一个新装的很好解决,把表空间数据文件和重做日志文件删除,然后启动。
101225 17:42:09 mysqld_safe Starting mysqld daemon with databases from /opt/mysqldata/data
101225 17:42:09 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use InnoDB's own implementation
InnoDB: The first specified data file /opt/mysqldata/data/ibdata1 did not exist:
InnoDB: a new database to be created!
101225 17:42:09 InnoDB: Setting file /opt/mysqldata/data/ibdata1 size to 100 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100
101225 17:42:14 InnoDB: Data file /opt/mysqldata/data/ibdata2 did not exist: new to be created
101225 17:42:14 InnoDB: Setting file /opt/mysqldata/data/ibdata2 size to 100 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100
101225 17:42:18 InnoDB: Log file /opt/mysqldata/data/ib_logfile0 did not exist: new to be created
InnoDB: Setting log file /opt/mysqldata/data/ib_logfile0 size to 16 MB
InnoDB: Database physically writes the file full: wait...
101225 17:42:19 InnoDB: Log file /opt/mysqldata/data/ib_logfile1 did not exist: new to be created
InnoDB: Setting log file /opt/mysqldata/data/ib_logfile1 size to 16 MB
InnoDB: Database physically writes the file full: wait...
101225 17:42:20 InnoDB: Log file /opt/mysqldata/data/ib_logfile2 did not exist: new to be created
InnoDB: Setting log file /opt/mysqldata/data/ib_logfile2 size to 16 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
101225 17:42:23 InnoDB Plugin 1.0.6 started; log sequence number 0
101225 17:42:23 [Note] Event Scheduler: Loaded 0 events
101225 17:42:23 [Note] /opt/mysqldata/libexec/mysqld: ready for connections.
Version: '5.1.45-log' socket: '/opt/mysqldata/mysql.sock' port: 3306 Source distributio
如果是一个使用了的数据库,就没这么简单了,保留原有的数据文件不变,再增加其他的;正常关闭数据库后,删除重做日志文件,当然最好有个全备份,并冷备份了相应的文件。以上为猜测,有机会验证一下。
所以在安装的时候就考虑清楚,设置好参数最为简单。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/758322/viewspace-682604/
,如需转载,请注明出处,否则将追究法律责任。