Wednesday 29 July 2015

ERROR 1210 (HY000): Incorrect arguments to DATA DIRECTORY



mysql> use demo2;
Database changed
mysql> CREATE TABLE t1 (
    -> a int,
    -> b text
    -> )
    -> DATA DIRECTORY='/usr/local/mysql/data'
    -> INDEX DIRECTORY='/usr/local/mysql/data';
ERROR 1210 (HY000): Incorrect arguments to DATA DIRECTORY
mysql>
mysql> select version();
+------------+
| version()  |
+------------+
| 5.6.11-log |
+------------+
1 row in set (0.00 sec)
mysql> show variables like '%datadir%';
+---------------+------------------------+
| Variable_name | Value                  |
+---------------+------------------------+
| datadir       | /usr/local/mysql/data/ |
+---------------+------------------------+
1 row in set (0.00 sec)
The default data dir already /usr/local/mysql/data/
We need to choose another different location
[root@Master ~]# cd /usr/local/mysql/
[root@Master mysql]# mkdir data1
[root@Master mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2424801
Server version: 5.6.11-log MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use demo2;
Database changed
mysql> CREATE TABLE t1 (
    -> a int,
    -> b text
    -> )
    -> DATA DIRECTORY='/usr/local/mysql/data1'
    -> INDEX DIRECTORY='/usr/local/mysql/data1';
ERROR 1030 (HY000): Got error -1 from storage engine
mysql>
Rights not enough on the new location, exit mysql and grant rights for new location
[root@Master data1]# chown -R mysql /usr/local/mysql/data1
[root@Master data1]# chgrp -R mysql /usr/local/mysql/data1


Now we login and try again
mysql> use demo2;
Database changed
mysql> CREATE TABLE t1 (
    -> a int,
    -> b text
    -> )
    -> DATA DIRECTORY='/usr/local/mysql/data1'
    -> INDEX DIRECTORY='/usr/local/mysql/data1';
Query OK, 0 rows affected, 1 warning (0.22 sec)
Table created successful.
[root@Master mysql]# cd data1
[root@Master data1]# ls -lah
total 12K
drwxr-xr-x.  3 mysql mysql 4.0K Jul 29 17:52 .
drwxr-xr-x. 14 mysql mysql 4.0K Jul 29 17:42 ..
drwxrwx---.  2 mysql mysql 4.0K Jul 29 17:52 demo2
[root@Master data1]# cd demo2;
[root@Master demo2]# ls -lah
total 104K
drwxrwx---. 2 mysql mysql 4.0K Jul 29 17:52 .
drwxr-xr-x. 3 mysql mysql 4.0K Jul 29 17:52 ..
-rw-rw----. 1 mysql mysql  96K Jul 29 17:52 t1.ibd
[root@Master demo2]#





No comments:

Post a Comment