· 9 years ago · Dec 22, 2016, 05:48 PM
1mysql> show variables like 'have_sym%';
2+---------------+-------+
3| Variable_name | Value |
4+---------------+-------+
5| have_symlink | YES |
6+---------------+-------+
71 row in set (0.09 sec)
8
9C:Windowssystem32>mklink
10Creates a symbolic link.
11
12MKLINK [[/D] | [/H] | [/J]] Link Target
13
14 /D Creates a directory symbolic link. Default is a file
15 symbolic link.
16 /H Creates a hard link instead of a symbolic link.
17 /J Creates a Directory Junction.
18 Link specifies the new symbolic link name.
19 Target specifies the path (relative or absolute) that the new link
20 refers to.
21
22C:Windowssystem32>
23
24use test
25drop table if exists data_table;
26drop table if exists data_table_sharded;
27CREATE TABLE data_table (a int,primary key(a)) ENGINE=MyISAM;
28CREATE TABLE data_table_sharded LIKE data_table;
29ALTER TABLE data_table_sharded DATA DIRECTORY='C:DAT' INDEX DIRECTORY='C:NDX';
30
31mysql> use test
32Database changed
33mysql> drop table if exists data_table;
34Query OK, 0 rows affected (0.02 sec)
35
36mysql> drop table if exists data_table_sharded;
37Query OK, 0 rows affected (0.02 sec)
38
39mysql> CREATE TABLE data_table (a int,primary key(a)) ENGINE=MyISAM;
40Query OK, 0 rows affected (0.00 sec)
41
42mysql> CREATE TABLE data_table_sharded LIKE data_table;
43Query OK, 0 rows affected (0.01 sec)
44
45mysql> ALTER TABLE data_table_sharded DATA DIRECTORY='C:DAT' INDEX DIRECTORY='C:NDX';
46Query OK, 0 rows affected, 2 warnings (0.02 sec)
47Records: 0 Duplicates: 0 Warnings: 2
48
49mysql> show warnings;
50+---------+------+----------------------------------+
51| Level | Code | Message |
52+---------+------+----------------------------------+
53| Warning | 1618 | <DATA DIRECTORY> option ignored |
54| Warning | 1618 | <INDEX DIRECTORY> option ignored |
55+---------+------+----------------------------------+
562 rows in set (0.00 sec)
57
58mysql>
59
60use test
61drop table if exists data_table;
62drop table if exists data_table_sharded;
63CREATE TABLE data_table (a int,primary key(a)) ENGINE=MyISAM;
64INSERT INTO data_table VALUES (71),(22),(128),(97),(18),(4),(112),(277);
65CREATE TABLE data_table_sharded LIKE data_table;
66
67C:MySQLdatatest>mklink /H data_table_sharded.MYD C:datdata_table_sharded.MYD
68Hardlink created for data_table_sharded.MYD <<===>> C:datdata_table_sharded.MYD
69
70C:MySQLdatatest>mklink /H data_table_sharded.MYI C:ndxdata_table_sharded.MYI
71Hardlink created for data_table_sharded.MYI <<===>> C:ndxdata_table_sharded.MYI
72
73C:MySQLdatatest>
74
75mysql> flush tables;
76Query OK, 0 rows affected (0.05 sec)
77
78mysql> INSERT INTO data_table_sharded SELECT * FROM data_table;
79Query OK, 8 rows affected (0.00 sec)
80Records: 8 Duplicates: 0 Warnings: 0
81
82mysql> show create table data_table_shardedG
83*************************** 1. row ***************************
84 Table: data_table_sharded
85Create Table: CREATE TABLE `data_table_sharded` (
86 `a` int(11) NOT NULL DEFAULT '0',
87 PRIMARY KEY (`a`)
88) ENGINE=MyISAM DEFAULT CHARSET=latin1
891 row in set (0.00 sec)
90
91mysql> select * from data_table_sharded;
92+-----+
93| a |
94+-----+
95| 4 |
96| 18 |
97| 22 |
98| 71 |
99| 97 |
100| 112 |
101| 128 |
102| 277 |
103+-----+
1048 rows in set (0.00 sec)
105
106mysql> flush tables;
107Query OK, 0 rows affected (0.00 sec)
108
109mysql>