我有一个大的.sql文件,我正在使用以下代码读入MySQL服务器...
mysql -vvv -u root < "%DIRECTORY%load_script.sql"
当我加载它时,我在命令提示符中以下列格式获得一大堆响应...
但是,我只想看到上图中红色封装的服务器的响应(查询和记录摘要的成功/失败状态)。
有谁知道如何实现这个目标?
更新
LOAD DATA LOCAL INFILE "C:/USERS/RHINO113/GOOGLE DRIVE/REPOS/REPO - IDMAS VESSELS APPLICATION/1.0 BACK END/1.2 SERVER CONFIG SCRIPT/2.2 IDMAS VESSELS DATA/API_574_STRUCTURAL_THICKNESS.CSV"
INTO TABLE API_574_STRUCTURAL_THICKNESS
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE "C:/USERS/RHINO113/GOOGLE DRIVE/REPOS/REPO - IDMAS VESSELS APPLICATION/1.0 BACK END/1.2 SERVER CONFIG SCRIPT/2.2 IDMAS VESSELS DATA/DAMAGE_MECHANISM_LIST.CSV"
INTO TABLE DAMAGE_MECHANISM_LIST
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE "C:/USERS/RHINO113/GOOGLE DRIVE/REPOS/REPO - IDMAS VESSELS APPLICATION/1.0 BACK END/1.2 SERVER CONFIG SCRIPT/2.2 IDMAS VESSELS DATA/STATUSES.CSV"
INTO TABLE STATUSES
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE "C:/USERS/RHINO113/GOOGLE DRIVE/REPOS/REPO - IDMAS VESSELS APPLICATION/1.0 BACK END/1.2 SERVER CONFIG SCRIPT/2.2 IDMAS VESSELS DATA/INSPECTION_STATUSES.CSV"
INTO TABLE INSPECTION_STATUSES
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE "C:/USERS/RHINO113/GOOGLE DRIVE/REPOS/REPO - IDMAS VESSELS APPLICATION/1.0 BACK END/1.2 SERVER CONFIG SCRIPT/2.2 IDMAS VESSELS DATA/REMEDIATION_STATUSES.CSV"
INTO TABLE REMEDIATION_STATUSES
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE "C:/USERS/RHINO113/GOOGLE DRIVE/REPOS/REPO - IDMAS VESSELS APPLICATION/1.0 BACK END/1.2 SERVER CONFIG SCRIPT/2.2 IDMAS VESSELS DATA/CML_TYPES.CSV"
INTO TABLE CML_TYPES
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE "C:/USERS/RHINO113/GOOGLE DRIVE/REPOS/REPO - IDMAS VESSELS APPLICATION/1.0 BACK END/1.2 SERVER CONFIG SCRIPT/2.2 IDMAS VESSELS DATA/EQUIPMENT.CSV"
INTO TABLE EQUIPMENT
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE "C:/USERS/RHINO113/GOOGLE DRIVE/REPOS/REPO - IDMAS VESSELS APPLICATION/1.0 BACK END/1.2 SERVER CONFIG SCRIPT/2.2 IDMAS VESSELS DATA/DAMAGE_MECHANISM.CSV"
INTO TABLE DAMAGE_MECHANISM
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE "C:/USERS/RHINO113/GOOGLE DRIVE/REPOS/REPO - IDMAS VESSELS APPLICATION/1.0 BACK END/1.2 SERVER CONFIG SCRIPT/2.2 IDMAS VESSELS DATA/CML.CSV"
INTO TABLE CML
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE "C:/USERS/RHINO113/GOOGLE DRIVE/REPOS/REPO - IDMAS VESSELS APPLICATION/1.0 BACK END/1.2 SERVER CONFIG SCRIPT/2.2 IDMAS VESSELS DATA/INSPECTION.CSV"
INTO TABLE INSPECTION
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
答案 0 :(得分:0)
要过滤详细的MySQL输出,请通过grep
用管道传输输出。您应该测试并调整此命令以使其对您的用例更加健壮。这是一个快速而肮脏的解决方案:
mysql -vvv -u root < "%DIRECTORY%load_script.sql" | grep -i -e 'query' -e 'records'
此命令将获取您的mysql输出,并查找包含单词query
或records
的行。 -i
使grep
不区分大小写,因此您可能会得到多余的行。失败的查询可能不会输出。我没有测试那么远。
这integer casting documentation看起来很有帮助,blog pos是grep
的GNU文档。