温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

mysql中使用innodb创建数据文件失败如何解决

发布时间:2021-07-28 16:25:03 来源:亿速云 阅读:665 作者:Leah 栏目:数据库

这篇文章给大家介绍mysql中使用innodb创建数据文件失败如何解决,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

innodb创建数据文件失败的解决
 
/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失败,目录权限已设置为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配置
  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
 

关于mysql中使用innodb创建数据文件失败如何解决就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI