[04:06:57](root@localhost)[(none)] > select concat('select * into outfile \'/tmp/',table_name,'.csv\' from ',table_schema,'.',table_name,';')
from information_schema.tables where table_schema='test';
| concat('select * into outfile \'/tmp/',table_name,'.csv\' from ',table_schema,'.',table_name,';') |
| select * into outfile '/tmp/address.csv' from test.address; |
| select * into outfile '/tmp/address1.csv' from test.address1; |
| select * into outfile '/tmp/clone_t.csv' from test.clone_t; |
| select * into outfile '/tmp/lock_test.csv' from test.lock_test; |
| select * into outfile '/tmp/query_history.csv' from test.query_history; |
| select * into outfile '/tmp/query_review.csv' from test.query_review; |
| select * into outfile '/tmp/ram.csv' from test.ram; |
| select * into outfile '/tmp/t.csv' from test.t; |
| select * into outfile '/tmp/t1.csv' from test.t1; |
| select * into outfile '/tmp/t2.csv' from test.t2; |
| select * into outfile '/tmp/t3.csv' from test.t3; |
| select * into outfile '/tmp/z.csv' from test.z; |
當需要對資料庫的表進行批量操作時,通過這種方式批量生成語句能大大提高效率
2、去除結果的虛線框並將結果輸出到檔案中-- 通常我們需要將生成的語句儲存到乙個檔案中,並且執行,這時就需要配合tee命令以及mysql客戶端的引數了
mysql --skip-column-names --silent (簡寫為 mysql -ss)能以靜默方式登入mysql伺服器並不顯示輸出結果的虛線框
tee /tmp/export.sql 將執行的結果儲存到檔案中
mysql靜默安裝 mysql5 7靜默安裝
cd opt wget tar xvf mysql 5.7.17 linux glibc2.5 x86 64.tar.gz mv mysql 5.7.17 linux glibc2.5 x86 64 mysql 2.路徑配置 basedir opt mysql datadir opt mysql d...
mysql怎麼登入 mysql怎麼登入
當 mysql 服務開啟後,就可以通過客戶端來登入 mysql 資料庫了。在 windows 作業系統下可以使用 dos 命令登入資料庫,本節將 介紹使用命令方式登入 mysql 資料庫的方法。登入 mysql 資料庫的具體操作步驟如下 步驟 1 單擊 開始 windows 系統 命令提示符 如圖所...
mysql登入密碼 mysql修改登入密碼三種方式
一.用set password命令 首先登入mysql,使用mysql自帶的那個客戶端連線上mysql。格式 mysql set password for 使用者名稱 localhost password 新密碼 例子 mysql set password for root localhost pa...