How to use ntfs-format datadir in mysql in ubuntu

Source: Internet
Author: User
Tags mysql in file permissions

First, describe the background. There are two local hard disks,

120 gb ssd = 60 (linux ext4) + 60 (win7 NTFS)

2 TB mechanical hard drive = 600 gb ntfs + 600g ntfs + 700G NTFS

In order to take care of Windows 7's compatibility with ext partitions, we set the three 2 TB partitions to NTFS, and now we are in trouble.

Because mysql is dealing with big data and SSD is not enough, it is necessary to transfer datadir and the ln method is used at first, but none of them can be used.

Later, we found that the owner of the ntfs partition file cannot be changed, that is, the chown is used to change the file (no error is reported). The actual owner is the root of the current partition)

I tried to solve this problem, so I modified fstab and changed the Mount according to the format of/dev/sda1 to UUID, but it still did not solve this problem.

After datadir is changed, an error is always reported when mysql is restarted,

Zs @ linux:/media/linux/lnRoot $ sudo/etc/init. d/mysql start
Rather than invoking init scripts through/etc/init. d, use the service (8)
Utility, e.g. service mysql start

Since the script you are attempting to invoke has been converted to
Upstart job, you may also use the start (8) utility, e.g. start mysql
Start: Job failed to start

So I searched and found .................

Ntfs is attached to ubuntu with 777 file permissions. The specific problems encountered during the operation and solutions are as follows:

1. Modify/etc/mysql/my. cnf

The code is as follows: Copy code

Set

Datadir =/var/lib/mysql

Change

Datadir =/media/MyDocuments/mysql

Try to restart mysql

The code is as follows: Copy code

Sudo/etc/init. d/mysql stop

Sudo/etc/init. d/mysql start

As a result, mysql cannot be restarted.

View the log,/var/log/mysql/error. log, as follows:

100819 15:10:20 [Note] Plugin 'Federated 'is disabled.
^ G/usr/sbin/mysqld: Can't find file: './mysql/plugin. Frm' (errno: 13)
100819 15:10:20 [ERROR] Can't open the mysql. plugin table. Please run mysql_upgrade to create it.
100819 15:10:20 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights
InnoDB: the directory.
InnoDB: File name./ibdata1
InnoDB: File operation call: 'open '.
InnoDB: Cannot continue operation.

After checking for a long time, we basically talked about the problem of apparmor. In fact, this is also mentioned in my. cnf,

The code is as follows: Copy code
# * IMPORTANT
# If you make changes to these settings and your system uses apparmor, you may
# Also need to also adjust/etc/apparmor. d/usr. sbin. mysqld.

OK. In this case, you will understand a lot. Modify/etc/apparmor. d/usr. sbin. mysqld.

Set

The code is as follows: Copy code
/Var/lib/mysql/r,
/Var/lib/mysql/** rwk,

Change

The code is as follows: Copy code
#/Var/lib/mysql/r,
#/Var/lib/mysql/** rwk,
/Media/MyDocuments/mysql/r,
/Media/MyDocuments/mysql/** rwk,

Run the following command:

The code is as follows: Copy code
/Etc/init. d/apparmor reload
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.