VPS侦探论坛

 找回密码
 注册
查看: 3271|回复: 2

修改数据目录启动报错

[复制链接]
发表于 2016-6-21 16:49:51 | 显示全部楼层 |阅读模式

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

目录
drwxr-xr-x 5 mariadb mariadb  4096 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 [Note] /usr/local/mariadb/bin/mysqld (mysqld 5.5.48-MariaDB) starting as process 9559 ...
160621 16:35:44 [Note] Plugin 'InnoDB' is disabled.
160621 16:35:44 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160621 16:35:44 [Note] Server socket created on IP: '0.0.0.0'.
160621 16:35:44 [ERROR] 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
[client]
#password       = your_password
port            = 3306
socket          = /tmp/mysql.sock

[mysqld]
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

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

[ 本帖最后由 piazini 于 2016-6-21 18:10 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2016-6-21 20:53:08 | 显示全部楼层


日志信息显示数据库确实提示的表,应该是没拷贝完整
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2016-6-21 23:42:00 | 显示全部楼层

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

谢谢军哥回答
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-16 04:53 , Processed in 0.025451 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表