技术开发 频道

主流行式数据库评测之开源MySQL5.5版本

[root@redflag11012501 mysql]# ls /usr/share/mysql/*cnf
/usr/share/mysql/my-huge.cnf             /usr/share/mysql/my-large.cnf   /usr/share/mysql/my-small.cnf
/usr/share/mysql/my-innodb-heavy-4G.cnf  /usr/share/mysql/my-medium.cnf
[root@redflag11012501 mysql]#cp /usr/share/mysql/my-innodb-heavy-4G.cnf /etc/my.cnf

   由于Linux的/文件系统空间有限,因此将数据文件目录改到空闲空间较多的/user1/mysql_db。用vi编辑/etc/my.cnf文件。另一种Linux和Unix下可用的方式是在数据库关闭时使用软连接,将数据库目录指向另一个目录。

innodb_data_file_path = ibdata1:1000M:autoextend
innodb_data_home_dir
= /user1/mysql_db
innodb_log_file_size
= 256M

   修改后保存/etc/my.cnf文件,用mysqld命令重新启动服务器,结果报错:

[root@redflag11012501 mysql]# mysqld --user=root
110603 10:29:28 [Note] Plugin 'FEDERATED' is disabled.
110603 10:29:28 InnoDB: The InnoDB memory heap is disabled
110603 10:29:28 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110603 10:29:28 InnoDB: Compressed tables use zlib 1.2.3
110603 10:29:28 InnoDB: Using Linux native AIO
110603 10:29:28 InnoDB: Initializing buffer pool, size = 20.0G
110603 10:29:30 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data
file /user1/mysql_db/ibdata1 did not exist:
InnoDB: a new
database to be created!
110603 10:29:30  InnoDB: Setting file /user1/mysql_db/ibdata1 size to 1000 MB
InnoDB:
Database physically writes the file full: wait...
InnoDB: Progress
in MB: 100 200 300 400 500 600 700 800 900 1000
110603 10:29:36 InnoDB: Error: all log files must be created at the same time.
110603 10:29:36 InnoDB: All log files must be created also in database creation.
110603 10:29:36 InnoDB: If you want bigger or smaller log files, shut down the
110603 10:29:36 InnoDB: database and make sure there were no errors in shutdown.
110603 10:29:36 InnoDB: Then delete the existing log files. Edit the .cnf file
110603 10:29:36 InnoDB: and start the database again.
110603 10:29:36 [ERROR] Plugin 'InnoDB' init function returned error.
110603 10:29:36 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
110603 10:29:36 [Note] Event Scheduler: Loaded 0 events
110603 10:29:36 [Note] mysqld: ready for connections.
Version:
'5.5.13-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
110603 10:30:10 [Note] mysqld: Normal shutdown

110603 10:30:10 [Note] Event Scheduler: Purging the queue. 0 events
110603 10:30:10 [Note] mysqld: Shutdown complete

   从提示信息可知,原有日志文件和新的数据文件不匹配,需要删除原有的文件。

  删除所有数据文件和日志文件,

[root@redflag11012501 mysql]# ll
总计
787260
-rw-rw---- 1 root  root  268435456 06-03 10:26 ib_logfile0
-rw-rw---- 1 root  root  268435456 06-03 10:26 ib_logfile1
-rw-rw---- 1 root  root  268435456 06-03 10:26 ib_logfile2
drwx--x--x 2 mysql mysql      4096 06-02 17:59 mysql
-rw-rw---- 1 root  root        126 06-03 10:14 mysql-bin.000001
-rw-rw---- 1 root  root        126 06-03 10:24 mysql-bin.000002
-rw-rw---- 1 root  root        126 06-03 10:26 mysql-bin.000003
-rw-rw---- 1 root  root        126 06-03 10:30 mysql-bin.000004
-rw-rw---- 1 root  root         76 06-03 10:29 mysql-bin.index
drwx------ 2 mysql mysql      4096 06-02 17:59 performance_schema
-rw-rw---- 1 mysql root       2079 06-03 09:44 redflag11012501.err
-rw-rw---- 1 root  root        692 06-03 10:29 redflag11012501-slow.log
-rw-r--r-- 1 root  root        121 06-02 17:59 RPM_UPGRADE_HISTORY
-rw-r--r-- 1 mysql mysql       121 06-02 17:59 RPM_UPGRADE_MARKER-LAST
drwxr-xr-x 2 mysql mysql      4096 06-02 17:59 test
[root@redflag11012501 mysql]# rm ib_logfile*
rm:是否删除 一般文件 “ib_logfile0”? t
rm:是否删除 一般文件 “ib_logfile1”? t
rm:是否删除 一般文件 “ib_logfile2”? t
[root@redflag11012501 mysql]# rm mysql-bin*
rm:是否删除 一般文件 “mysql
-bin.000001”? t
rm:是否删除 一般文件 “mysql
-bin.000002”? t
rm:是否删除 一般文件 “mysql
-bin.000003”? t
rm:是否删除 一般文件 “mysql
-bin.000004”? t
rm:是否删除 一般文件 “mysql
-bin.index”? t
[root@redflag11012501 mysql]# rm /user1/mysql_db/*
rm:是否删除 一般文件 “/user1/mysql_db/ibdata1”? y

   同时将日志文件目录也修改,重新启动就可以了。

0
相关文章