/etc/my.cnf配置 [mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# default to using old password
/etc/my.cnf配置
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
# disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0
default-character-set=utf8
default-storage-engine=innodb
# uncomment the following if you are using innodb tables
innodb_data_home_dir = /var/mysql/innodb/
innodb_data_file_path = ibdata1:2000m;ibdata2:10m:autoextend
innodb_log_group_home_dir = /var/mysql/innodb/log/
innodb_log_arch_dir = /var/mysql/innodb/log/
# you can set .._buffer_pool_size up to 50 - 80 %
# of ram but beware of setting memory usage too high
innodb_buffer_pool_size = 1024m
innodb_additional_mem_pool_size = 20m
# set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 192m
innodb_log_buffer_size = 18m
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
[client]
default-character-set=gbk
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
启动mysqld失败,目录权限已设置为777, 并已 /usr/bin/mysql_install_db --user=mysql
原因似乎是innodb的数据目录必须处于datadir配置的子目录下!
查看日志 /var/log/mysqld.log
.........................
120817 13:08:17 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 /var/mysql/innodb/ibdata1
innodb: file operation call: 'create'.
innodb: cannot continue operation.
120817 13:08:17 mysqld ended
修改/etc/my.cnf配置
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
# disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0
default-character-set=utf8
default-storage-engine=innodb
# uncomment the following if you are using innodb tables
innodb_data_home_dir=/var/lib/mysql/innodb/
innodb_data_file_path=ibdata1:2000m;ibdata2:10m:autoextend
innodb_log_group_home_dir=/var/lib/mysql/innodb/log/
innodb_log_arch_dir=/var/lib/mysql/innodb/log/
# you can set .._buffer_pool_size up to 50 - 80 %
# of ram but beware of setting memory usage too high
innodb_buffer_pool_size=1024m
innodb_additional_mem_pool_size=20m
# set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size=192m
innodb_log_buffer_size=18m
innodb_flush_log_at_trx_commit=1
innodb_lock_wait_timeout=50
[client]
default-character-set=gbk
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
启动成功。
,