本周末关闭服务器后,我无法启动MariaDB。我在日志中看到了这一点:
171030 10:09:18 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
171030 10:09:18 [Note] /usr/sbin/mysqld (mysqld 5.5.45-MariaDB) starting as process 2583 ...
171030 10:09:18 InnoDB: The InnoDB memory heap is disabled
171030 10:09:18 InnoDB: Mutexes and rw_locks use GCC atomic builtins
171030 10:09:18 InnoDB: Compressed tables use zlib 1.2.3
171030 10:09:18 InnoDB: Using Linux native AIO
171030 10:09:18 InnoDB: Initializing buffer pool, size = 128.0M
171030 10:09:18 InnoDB: Completed initialization of buffer pool
171030 10:09:18 InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: File name /var/lib/mysql//var/lib/mysql/ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
171030 10:09:18 mysqld_safe mysqld from pid file /var/lib/mysql/db05.pid ended
这看起来很明显:
InnoDB: File name /var/lib/mysql//var/lib/mysql/ibdata1
我不知道它到底在哪里。这是my.cnf文件:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
# innodb_force_recovery = 4
lower_case_table_names = 1
character-set-server=utf8
collation-server=utf8_bin
default-storage-engine=INNODB
max_allowed_packet=256M
innodb_data_home_dir = /var/lib/mysql
innodb_data_file_path = /var/lib/mysql/ibdata1:3000M;/var/lib/mysql/ibdata2:586M:autoextend
transaction-isolation=READ-COMMITTED
innodb_log_buffer_size = 32M
innodb_buffer_pool_size = 3G
innodb_log_file_size = 768M
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
我已经尝试添加显示的日志文件条目,并根据我看到的其他错误增加innodb_data_file_path参数中的ibdata1大小,我不再认为这些错误是相关的。
答案 0 :(得分:1)
您的服务器正在生成一个奇怪的路径名来设置ibdata1
容器文件。当它Path/Path/Filename
时,它正在/var/lib/mysql//var/lib/mysql/ibdata1
。
您可以尝试在my.cnf
innodb_data_file_path = /var/lib/mysql/ibdata1:3000M;/var/lib/mysql/ibdata2:586M:autoextend
到此:
innodb_data_file_path = ibdata1:3000M;ibdata2:586M:autoextend
如果不起作用则放回原始值。然后做
px axuww | grep mysql
到shell,并尝试确定你的mysqld服务器程序是否正在使用它不需要的额外路径变量运行。
答案 1 :(得分:1)
显然,/var/lib/mysql
设置中存在路径innodb_data_home_dir
:
innodb_data_home_dir = /var/lib/mysql
但它也出现在innodb_data_file_path
中。所以改变一下:
innodb_data_file_path = /var/lib/mysql/ibdata1:3000M;/var/lib/mysql/ibdata2:586M:autoextend
对此:
innodb_data_file_path = ibdata1:3000M;ibdata2:586M:autoextend