piazini 发表于 2016-6-21 16:49:51

修改数据目录启动报错

按照“常见问题”里修改了数据存入路径,权限也改了,也从从源目录cp了文件,还是出错。想把数据存放到/data/mariadb/下,但是只要修改回去就正常了。

目录
drwxr-xr-x 5 mariadb mariadb4096 Jun 21 16:25 mariadb

下面是err的LOG
160621 16:35:44 mysqld_safe Starting mysqld daemon with databases from /data/mariadb/var
160621 16:35:44 /usr/local/mariadb/bin/mysqld (mysqld 5.5.48-MariaDB) starting as process 9559 ...
160621 16:35:44 Plugin 'InnoDB' is disabled.
160621 16:35:44 Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160621 16:35:44 Server socket created on IP: '0.0.0.0'.
160621 16:35:44 Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
160621 16:35:44 mysqld_safe mysqld from pid file /usr/local/mariadb/var/mariadb.pid ended

下面是my.cnf

#password       = your_password
port            = 3306
socket          = /tmp/mysql.sock


port            = 3306
socket          = /tmp/mysql.sock
user    = mariadb
basedir = /usr/local/mariadb
datadir = /data/mariadb/var
log_error = /usr/local/mariadb/var/mariadb.err
pid-file = /usr/local/mariadb/var/mariadb.pid
default_storage_engine = MyISAM
loose-skip-innodb
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 100M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
thread_cache_size = 8
query_cache_size = 8M
tmp_table_size = 16M

#skip-networking
max_connections = 500
max_connect_errors = 100
open_files_limit = 65535

log-bin=mysql-bin
binlog_format=mixed
server-id       = 1
expire_logs_days = 10

#innodb_data_home_dir = /data/mariadb/var
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mariadb/var
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1

#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50


quick
max_allowed_packet = 16M


no-auto-rehash


key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M


interactive-timeout

[ 本帖最后由 piazini 于 2016-6-21 18:10 编辑 ]

licess 发表于 2016-6-21 20:53:08

日志信息显示数据库确实提示的表,应该是没拷贝完整

piazini 发表于 2016-6-21 23:42:00

解决了
先停止MYSQL
迁移时先用 cp -a /usr/local/mariadb/var/* /data/mariadb/ 记着用-a参数
在用chown -R mariadb:mariadb /data/mariadb 用-R参数递归目录用户和组
在启动MYSQL就可以了:victory:

谢谢军哥回答
页: [1]
查看完整版本: 修改数据目录启动报错