技术开发 频道

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

# Total number of files in the log group. A value of 2-3 is usually good
# enough.
innodb_log_files_in_group
= 2

# Location
of the InnoDB log files. Default is the MySQL datadir. You
# may wish
to point it to a dedicated hard drive or a RAID1 volume for
# improved performance
#innodb_log_group_home_dir
innodb_log_group_home_dir
= /user1/mysql_db
# Maximum allowed percentage
of dirty pages in the InnoDB buffer pool.
"
/etc/my.cnf" 479L, 19863C 已写入                                                                                
[root@redflag11012501 mysql]# rm /user1/mysql_db/*
rm:是否删除 一般文件 “/user1/mysql_db/ibdata1”? y
[root@redflag11012501 mysql]# mysqld --user=root
110603 10:42:38 [Note] Plugin 'FEDERATED' is disabled.
110603 10:42:38 InnoDB: The InnoDB memory heap is disabled
110603 10:42:38 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110603 10:42:38 InnoDB: Compressed tables use zlib 1.2.3
110603 10:42:38 InnoDB: Using Linux native AIO
110603 10:42:38 InnoDB: Initializing buffer pool, size = 20.0G
110603 10:42:40 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:42:40  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:42:45  InnoDB: Log file /user1/mysql_db/ib_logfile0 did not exist: new to be created
InnoDB: Setting log file /user1/mysql_db/ib_logfile0 size to 256 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200
110603 10:42:46  InnoDB: Log file /user1/mysql_db/ib_logfile1 did not exist: new to be created
InnoDB: Setting log file /user1/mysql_db/ib_logfile1 size to 256 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
110603 10:42:47  InnoDB: Waiting for the background threads to start
110603 10:42:48 InnoDB: 1.1.7 started; log sequence number 0
110603 10:42:48 [Note] Event Scheduler: Loaded 0 events
110603 10:42:48 [Note] mysqld: ready for connections.
Version: '5.5.13-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)

   但是我们改用service mysql start启动时出错。

[root@redflag11012501 mysql]# service mysql start
Starting MySQL.The server quit without updating PID
file (/var/lib/mysql/redflag11012501.pid).[失败]

   通过查看err文件的错误信息提示,这是相关目录的权限问题。修改相关目录和文件的属主后问题解决。

[root@redflag11012501 tmp]# chown -R mysql:mysql /var/lib/mysql
[root@redflag11012501 tmp]# service mysql start
Starting MySQL...The server quit without updating PID
file (/var/lib/mysql/redflag11012501.pid).[失败]
[root@redflag11012501 tmp]# tail /var/lib/mysql/redflag11012501.err
110608 11:21:22 InnoDB: Using Linux native AIO
110608 11:21:22 InnoDB: Initializing buffer pool, size = 20.0G
110608 11:21:24 InnoDB: Completed initialization of buffer pool
110608 11:21:24  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does
not have the access rights to
InnoDB: the directory.
InnoDB:
File name /user1/mysql_db/ibdata1
InnoDB:
File operation call: 'open'.
InnoDB: Cannot
continue operation.
110608 11:21:24 mysqld_safe mysqld from pid file /var/lib/mysql/redflag11012501.pid ended
[root@redflag11012501 tmp]# chown -R mysql:mysql /user1/mysql_db/
[root@redflag11012501 tmp]# service mysql start
Starting MySQL........The server quit without updating PID
file (/var/lib/mysql/redflag11012501.pid).[失败]
使用
--user=root参数mysqld_safe可以启动
[root@redflag11012501 tmp]# mysqld_safe --user=root
110608 13:59:54 mysqld_safe Logging to '/var/lib/mysql/redflag11012501.err'.
110608 13:59:54 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql


110608 14:00:28 mysqld_safe mysqld from pid file /var/lib/mysql/redflag11012501.pid ended
[root@redflag11012501 tmp]#
不使用
--user=root参数mysqld_safe启动失败
[root@redflag11012501 tmp]# mysqld_safe &
[1] 8415
[root@redflag11012501 tmp]# 110608 14:01:06 mysqld_safe Logging to '/var/lib/mysql/redflag11012501.err'.
110608 14:01:06 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

[root@redflag11012501 tmp]#
[root@redflag11012501 tmp]# 110608 14:01:13 mysqld_safe mysqld from pid file /var/lib/mysql/redflag11012501.pid ended

[1]+  Done                    mysqld_safe
[root@redflag11012501 tmp]# tail /var/lib/mysql/redflag11012501.err
110608 14:01:11 [ERROR] Failed to open log (file './mysql-bin.000018', errno 13)
110608 14:01:11 [ERROR] Could not open log file
110608 14:01:11 [ERROR] Can't init tc log
110608 14:01:11 [ERROR] Aborting

110608 14:01:11  InnoDB: Starting shutdown...
110608 14:01:13  InnoDB: Shutdown completed; log sequence number 58674268879
110608 14:01:13 [Note] /usr/sbin/mysqld: Shutdown complete

110608 14:01:13 mysqld_safe mysqld from pid file /var/lib/mysql/redflag11012501.pid ended
[root@redflag11012501 tmp]# cd  /var/lib/mysql
[root@redflag11012501 mysql]# ll
总计 104
drwx--x--x 2 mysql mysql  4096 06-02 17:59 mysql
-rw-rw---- 1 mysql mysql   150 06-04 19:42 mysql-bin.000015
-rw-rw---- 1 mysql mysql   677 06-08 11:03 mysql-bin.000016
-rw-rw---- 1 root  root    126 06-08 11:22 mysql-bin.000017
-rw-rw---- 1 root  root    126 06-08 14:00 mysql-bin.000018
-rw-rw---- 1 mysql mysql    76 06-08 13:59 mysql-bin.index
drwx------ 2 mysql mysql  4096 06-02 17:59 performance_schema
-rw-rw---- 1 mysql mysql  9885 06-08 14:01 redflag11012501.err
-rw-rw---- 1 mysql mysql 45588 06-08 14:01 redflag11012501-slow.log
-rw-r--r-- 1 mysql mysql   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
drwx------ 2 mysql mysql  4096 06-04 20:32 tpch
--修改二进制日志文件的属主
[root@redflag11012501 mysql]# chown mysql:mysql mysql-bin.*
[root@redflag11012501 mysql]# service mysql start
Starting MySQL.......[确定]

   另外,值得注意的,MySQL 5.5的默认存储引擎已经改为InnoDB,但样本配置文件中有这么一行:default-storage-engine = MYISAM,需要把它注释掉,否则默认创建的表存储引擎还是MyISAM,此外,如果数据库不需要主从复制,也可以通过注释log-bin=mysql-bin一行,将二进制日志功能关闭。

  至此,安装过程结束。

0
相关文章