通過連線的方式把資料檔案放在別的地方
上篇寫到通過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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 1.6.5.2. 通過密碼檔案驗證連線資料庫密碼資料庫
- 織夢CMS(dedecms)的資料庫連線檔案_織夢連線資料庫檔案資料庫
- Java的JDBC通過SSH Tunnel連線MySQL資料庫JavaJDBCMySql資料庫
- iis連線資料庫的檔案是哪個資料庫
- 把list集合的內容寫入到Xml中,通過XmlDocument方式寫入Xml檔案中XML
- 資料庫的連線過程資料庫
- oracle資料庫透過sqlplus連線的幾種方式介紹Oracle資料庫SQL
- 1.3.3. 通過SQL*Plus 連線資料庫SQL資料庫
- Android連線網路資料庫的方式Android資料庫
- 把AirDrop放在程式塢,讓檔案傳送更方便AI
- 網站連線資料庫配置檔案網站資料庫
- 0459-如何使用SQuirreL通過JDBC連線CDH的Hive(方式一)UIJDBCHive
- 連線別人的MySql資料庫MySql資料庫
- root 使用者通過 sqlplus 連線資料庫SQL資料庫
- 通過本地直接連線linux伺服器的mysql資料庫Linux伺服器MySql資料庫
- mysql通過frm、idb檔案恢復資料MySql
- VMWARE虛擬機器的Ubuntu通過橋接方式連線主機虛擬機Ubuntu橋接
- Mysql通過ibd檔案恢復資料的步驟詳解MySql
- Java讀取properties檔案連線資料庫Java資料庫
- 通過觸發器記錄資料庫連線資訊觸發器資料庫
- 如何透過連線資料庫的方式對線下應用進行線上擴充套件資料庫套件
- JAVA通過URL連結獲取視訊檔案資訊(無需下載檔案)Java
- 4.SpringBoot中採用什麼方式進行配置專案檔案?SpringBoot如何讀取配置檔案中連線資料庫的資料?嘻哈的簡寫筆記——SpringBootSpring Boot資料庫筆記
- 通過驅動建立與MySQL的連線MySql
- python 通過 Web3.py 連線以太坊區塊鏈的幾種方式PythonWeb區塊鏈
- python連線clickhouse資料庫的兩種方式小結Python資料庫
- 117 遠端連線mysql資料庫的幾種方式MySql資料庫
- 通過Python實現對SQL Server 資料檔案大小的監控告警PythonSQLServer
- kettle通過命令列引數傳遞資料庫連線資訊命令列資料庫
- 找到織夢CMS的資料庫配置檔案,以便了解資料庫的具體連線資訊資料庫
- 把多個資料夾中的檔案批量放到一個資料夾
- 資料恢復新姿勢——通過ibd和frm檔案恢復資料資料恢復
- win10不透過RaiDrive直接連線webDev的方式Win10AIWebdev
- Laravel 通過 ODBC 連線 VerticaLaravel
- 通過跳板機連線MySQLMySql
- 4243.全文檢索與檔案匯出試驗 ⑤建立“連結到檔案、連結到資料夾”最快的方式是什麼?...
- 教程:如何通過DLA實現資料檔案格式轉換
- Kettle自定義資料庫連線型別連線HGDB資料庫型別
- C#連線Oracle資料庫,通過EF自動生成與資料庫表相關的實體類C#Oracle資料庫