MySQL更改datadir报错无法启动

在ubuntu上将mysql的存储目录更改到其他磁盘分区上更改步骤:1.、/etc/init.d/mysql stop2、vim /etc/mysql/my.cnf     datadir                = /data/mysql       //之前...显示全部
在ubuntu上将mysql的存储目录更改到其他磁盘分区上
更改步骤:
1.、/etc/init.d/mysql stop
2、vim /etc/mysql/my.cnf
     datadir                = /data/mysql       //之前为/var/lib/mysql
3、mv /var/lib/mysql  /data/                   //data在其他分区上
4 、/etc/init.d/mysql start
但是重启后就显示各种报错信息:
150611 13:41:39 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
150611 13:42:31 mysqld_safe Starting mysqld daemon with databases from /data/mysql
150611 13:42:31 [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.
150611 13:42:31 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0ubuntu0.14.04.1) starting as process 26942 ...
150611 13:42:31 [Warning] Can't create test file /data/mysql/iZ23urd20hoZ.lower-test
150611 13:42:31 [Warning] Can't create test file /data/mysql/iZ23urd20hoZ.lower-test
150611 13:42:31 [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.
150611 13:42:31 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
150611 13:42:31 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
150611 13:42:31 InnoDB: The InnoDB memory heap is disabled
150611 13:42:31 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150611 13:42:31 InnoDB: Compressed tables use zlib 1.2.8
150611 13:42:31 InnoDB: Using Linux native AIO
150611 13:42:31 InnoDB: Initializing buffer pool, size = 128.0M
150611 13:42:31 InnoDB: Completed initialization of buffer pool
150611 13:42:31  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.
150611 13:42:31 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
请问各位大神,是哪里有问题吗。第3行的那个“nstead of”应该影响不大吧。
我在新开的虚拟机上按照上面的步骤,就成功了,没有这么多报错。收起
参与3

返回ghl116的回答

ghl116ghl116软件开发工程师兴业数金

是不是没权限?或者原来的数据文件拷错目录了?
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.

银行 · 2022-04-12
浏览462

回答者

ghl116
ghl1160319
软件开发工程师兴业数金
擅长领域: 云计算容器容器云

ghl116 最近回答过的问题

回答状态

  • 发布时间:2022-04-12
  • 关注会员:2 人
  • 回答浏览:462
  • X社区推广