通過連線的方式把資料檔案放在別的地方
上篇寫到通過create table data direcotry把資料檔案放在別的地方。http://blog.itpub.net/25099483/viewspace-1662886/
對於建立好的表同樣以
通過連線的方式把資料檔案放在別的地方:
mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from t1;
+------+------+------+
| id | name | sex |
+------+------+------+
| 1 | NULL | NULL |
| 2 | NULL | NULL |
+------+------+------+
2 rows in set (0.00 sec)
mysql> flush tables;
Query OK, 0 rows affected (0.00 sec)
[mysql@localhost test]$ mv t1.ibd /data2/aaa
[mysql@localhost test]$ cd /data2/aaa/
[mysql@localhost aaa]$ ll
total 224
-rw-rw----. 1 mysql mysql 131072 May 18 22:38 t1.ibd
-rw-rw----. 1 mysql mysql 98304 May 19 20:32 test.ibd
[mysql@localhost test]$ cd /data2/aaa/
[mysql@localhost aaa]$ ll
total 224
-rw-rw----. 1 mysql mysql 131072 May 18 22:38 t1.ibd
-rw-rw----. 1 mysql mysql 98304 May 19 20:32 test.ibd
[mysql@localhost test]$ ll | grep t1.i
lrwxrwxrwx. 1 mysql mysql 17 May 19 20:46 t1.ibd -> /data2/aaa/t1.ibd
lrwxrwxrwx. 1 mysql mysql 17 May 19 20:46 t1.ibd -> /data2/aaa/t1.ibd
mysql> exit
Bye
[mysql@localhost ~]$ ps -ef | grep mysql
root 2000 1878 0 20:21 ? 00:00:00 sshd: mysql [priv]
mysql 2049 2000 0 20:21 ? 00:00:00 sshd: mysql@pts/1,pts/0,pts/2,pts/3
mysql 2052 2049 0 20:21 pts/1 00:00:00 -bash
mysql 2399 2052 0 20:22 pts/1 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/usr/my-new.cnf
mysql 2631 2399 0 20:22 pts/1 00:00:00 /usr/sbin/mysqld --defaults-file=/usr/my-new.cnf --basedir=/usr --datadir=/data --plugin-dir=/usr/lib64/mysql/plugin --log-error=/data/localhost.localdomain.err --pid-file=/data/localhost.localdomain.pid
mysql 2656 2049 0 20:24 pts/0 00:00:00 -bash
mysql 2689 2049 0 20:32 pts/2 00:00:00 -bash
mysql 2711 2049 0 20:33 pts/3 00:00:00 -bash
mysql 2757 2052 6 20:47 pts/1 00:00:00 ps -ef
mysql 2758 2052 0 20:47 pts/1 00:00:00 grep mysql
[mysql@localhost ~]$ kill -9 2631 2399 --關庫
[mysql@localhost ~]$
[1]+ Killed mysqld_safe --defaults-file=/usr/my-new.cnf
[mysql@localhost ~]$
[mysql@localhost ~]$
[mysql@localhost ~]$ mysqld_safe --defaults-file=/usr/my-new.cnf & --啟庫
[1] 2759
[mysql@localhost ~]$ 150519 20:47:15 mysqld_safe Logging to '/data/localhost.localdomain.err'.
150519 20:47:15 mysqld_safe Starting mysqld daemon with databases from /data
[mysql@localhost ~]$
[mysql@localhost ~]$
[mysql@localhost ~]$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2015, 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 test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from t1; --檢視沒有錯誤
+------+------+------+
| id | name | sex |
+------+------+------+
| 1 | NULL | NULL |
| 2 | NULL | NULL |
+------+------+------+
2 rows in set (0.00 sec)
mysql> insert into t1 (id) values (3);
Query OK, 1 row affected (0.01 sec)
mysql> select * from t1;
+------+------+------+
| id | name | sex |
+------+------+------+
| 1 | NULL | NULL |
| 2 | NULL | NULL |
| 3 | NULL | NULL |
+------+------+------+
3 rows in set (0.00 sec)
Bye
[mysql@localhost ~]$ ps -ef | grep mysql
root 2000 1878 0 20:21 ? 00:00:00 sshd: mysql [priv]
mysql 2049 2000 0 20:21 ? 00:00:00 sshd: mysql@pts/1,pts/0,pts/2,pts/3
mysql 2052 2049 0 20:21 pts/1 00:00:00 -bash
mysql 2399 2052 0 20:22 pts/1 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/usr/my-new.cnf
mysql 2631 2399 0 20:22 pts/1 00:00:00 /usr/sbin/mysqld --defaults-file=/usr/my-new.cnf --basedir=/usr --datadir=/data --plugin-dir=/usr/lib64/mysql/plugin --log-error=/data/localhost.localdomain.err --pid-file=/data/localhost.localdomain.pid
mysql 2656 2049 0 20:24 pts/0 00:00:00 -bash
mysql 2689 2049 0 20:32 pts/2 00:00:00 -bash
mysql 2711 2049 0 20:33 pts/3 00:00:00 -bash
mysql 2757 2052 6 20:47 pts/1 00:00:00 ps -ef
mysql 2758 2052 0 20:47 pts/1 00:00:00 grep mysql
[mysql@localhost ~]$ kill -9 2631 2399 --關庫
[mysql@localhost ~]$
[1]+ Killed mysqld_safe --defaults-file=/usr/my-new.cnf
[mysql@localhost ~]$
[mysql@localhost ~]$
[mysql@localhost ~]$ mysqld_safe --defaults-file=/usr/my-new.cnf & --啟庫
[1] 2759
[mysql@localhost ~]$ 150519 20:47:15 mysqld_safe Logging to '/data/localhost.localdomain.err'.
150519 20:47:15 mysqld_safe Starting mysqld daemon with databases from /data
[mysql@localhost ~]$
[mysql@localhost ~]$
[mysql@localhost ~]$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2015, 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 test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from t1; --檢視沒有錯誤
+------+------+------+
| id | name | sex |
+------+------+------+
| 1 | NULL | NULL |
| 2 | NULL | NULL |
+------+------+------+
2 rows in set (0.00 sec)
mysql> insert into t1 (id) values (3);
Query OK, 1 row affected (0.01 sec)
mysql> select * from t1;
+------+------+------+
| id | name | sex |
+------+------+------+
| 1 | NULL | NULL |
| 2 | NULL | NULL |
| 3 | NULL | NULL |
+------+------+------+
3 rows in set (0.00 sec)
轉載請註明源出處
QQ 273002188 歡迎一起學習
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25099483/viewspace-1662903/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 通過讀取properties檔案動態生成對資料庫的連線資料庫
- 1.6.5.2. 通過密碼檔案驗證連線資料庫密碼資料庫
- 織夢CMS(dedecms)的資料庫連線檔案_織夢連線資料庫檔案資料庫
- Java的JDBC通過SSH Tunnel連線MySQL資料庫JavaJDBCMySql資料庫
- iis連線資料庫的檔案是哪個資料庫
- 資料庫的連線過程資料庫
- 1.3.3. 通過SQL*Plus 連線資料庫SQL資料庫
- 通過cmd命令列連線mysql資料庫命令列MySql資料庫
- Qt中通過ODBC連線MSSQL資料庫QTSQL資料庫
- mybatis連線資料庫的幾種方式MyBatis資料庫
- 把list集合的內容寫入到Xml中,通過XmlDocument方式寫入Xml檔案中XML
- 通過資料庫檔案還原資料庫資料庫
- 通過檔案控制程式碼恢復刪除的資料檔案
- 採用Duplicate不連線target資料庫的方式將檔案系統遷移到ASM資料庫ASM
- 0459-如何使用SQuirreL通過JDBC連線CDH的Hive(方式一)UIJDBCHive
- Oracle資料庫連線方式Oracle資料庫
- 通過Java程式測試資料庫連線資訊Java資料庫
- 使用perl通過thrift連線hbase讀取資料
- 通過連線檢視資料庫相關資訊資料庫
- 連線別人的MySql資料庫MySql資料庫
- 通過修改jdbc配置檔案方式修改Weblogic資料來源密碼JDBCWeb密碼
- 網站連線資料庫配置檔案網站資料庫
- 表空間離線與資料檔案離線的區別
- Android連線網路資料庫的方式Android資料庫
- 資料庫表的連線方式及用法(一)資料庫
- 通過移動資料檔案來均衡檔案I/O
- [轉] 通過ADO連線各種資料庫的字串翠集資料庫字串
- 通過原始碼的方式編譯hadoop的安裝檔案原始碼編譯Hadoop
- 把AirDrop放在程式塢,讓檔案傳送更方便AI
- VMWARE虛擬機器的Ubuntu通過橋接方式連線主機虛擬機Ubuntu橋接
- oracle資料庫透過sqlplus連線的幾種方式介紹Oracle資料庫SQL
- 通過觸發器記錄資料庫連線資訊觸發器資料庫
- mysql--通過cmd連線mysql,並建立資料庫MySql資料庫
- 把檔案系統的資料檔案遷移到ASM儲存ASM
- 使用hostname方式連線資料庫!資料庫
- Spring連線資料庫的幾種常用的方式Spring資料庫
- Java讀取properties檔案連線資料庫Java資料庫
- 通過本地直接連線linux伺服器的mysql資料庫Linux伺服器MySql資料庫