共計 2719 個字符,預計需要花費 7 分鐘才能閱讀完成。
這篇文章給大家介紹 mysql 中使用 innodb 創(chuàng)建數(shù)據(jù)文件失敗如何解決,內(nèi)容非常詳細,感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。
innodb 創(chuàng)建數(shù)據(jù)文件失敗的解決
/etc/my.cnf 配置
www.2cto.com
[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/
www.2cto.com
# 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 失敗,目錄權(quán)限已設(shè)置為 777,并已 /usr/bin/mysql_install_db –user=mysql
原因似乎是 innodb 的數(shù)據(jù)目錄必須處于 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 配置
www.2cto.com
[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
www.2cto.com
[client]
default-character-set=gbk
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
關(guān)于 mysql 中使用 innodb 創(chuàng)建數(shù)據(jù)文件失敗如何解決就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。