Ubuntu的Java环境镜像自带的MySQL数据目录无法移动的问题-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

Ubuntu的Java环境镜像自带的MySQL数据目录无法移动的问题

tadpole128 2014-05-18 20:52:29 11081
开通ECS时选择了Ubuntu的Java环境镜像,其中自带了MySQL,但MySQL的数据目录在/var/lib/mysql下。
因为我已购买数据盘,并挂载为/data,想把MySQL的数据目录移动到/data/mysql下,始终不成功。求解答!
我做的步骤:
1、关闭MySQL:service mysql stop
2、复制数据目录:cp -ria /var/lib/mysql /data/mysql,也试过mv /var/lib/mysql/data/mysql
3、修改/etc/mysql/my.cnf文件中的data_dir配置项
4、启动MySQL结果:始终报如下错误:
140518 20:44:10 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
140518 20:44:10 [Warning] Can't create test file /data/mysql/AY140514205840355de9Z.lower-test
140518 20:44:10 [Warning] Can't create test file /data/mysql/AY140514205840355de9Z.lower-test
140518 20:44:10 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140518 20:44:10 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
140518 20:44:10 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
140518 20:44:10 InnoDB: The InnoDB memory heap is disabled
140518 20:44:10 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140518 20:44:10 InnoDB: Compressed tables use zlib 1.2.3.4
140518 20:44:10 InnoDB: Initializing buffer pool, size = 128.0M
140518 20:44:10 InnoDB: Completed initialization of buffer pool
140518 20:44:10  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 ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

5、核对目录权限应该没有问题
:~# ls -l /data/mysql
total 28736
-rw-r--r-- 1 mysql mysql        0 Apr 24 20:11 debian-5.5.flag
-rw-rw---- 1 mysql mysql 18874368 May 16 15:05 ibdata1
-rw-rw---- 1 mysql mysql  5242880 May 16 15:05 ib_logfile0
-rw-rw---- 1 mysql mysql  5242880 Apr 15 12:26 ib_logfile1
drwx------ 2 mysql mysql     4096 Apr 24 20:11 mysql
-rw-rw---- 1 mysql mysql        6 Apr 24 20:11 mysql_upgrade_info
drwx------ 2 mysql mysql     4096 Apr 24 20:11 performance_schema
drwx------ 2 mysql mysql     4096 Apr 15 12:26 test


:~# ls -l /var/lib/mysql
total 28688
-rw-r--r-- 1 mysql mysql        0 Apr 24 20:11 debian-5.5.flag
-rw-rw---- 1 mysql mysql 18874368 May 16 16:43 ibdata1
-rw-rw---- 1 mysql mysql  5242880 May 16 16:43 ib_logfile0
-rw-rw---- 1 mysql mysql  5242880 Apr 15 12:26 ib_logfile1
drwx------ 2 mysql mysql     4096 Apr 24 20:11 mysql
-rw-rw---- 1 mysql mysql        6 Apr 24 20:11 mysql_upgrade_info
drwx------ 2 mysql mysql     4096 Apr 24 20:11 performance_schema
drwx------ 2 mysql mysql     4096 Apr 15 12:26 test
弹性计算 Ubuntu 关系型数据库 MySQL Java C语言
分享到
取消 提交回答
全部回答(0)
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

推荐文章
相似问题
推荐课程