利用MySQL客户端批量执行sql语句

WBOY
リリース: 2016-06-07 17:25:06
オリジナル
797 人が閲覧しました

在OceanBase中,将sql语句写到my.sql文本文件中,然后用重定向命令将其批量导入到mysql客户端中执行即可。

[linuxidc.com @OceanBase ~]$ cat my.sql
create table x (a1 int, a2 int, a3 int, b1 int, b2 int, primary key(a1,a2,a3));
insert into x(a1,a2,a3,b1,b2) values (1,1,2,0,0);

[linuxidc.com @OceanBase ~]$ mysql -h1.32.36.29 -P4797 -uadmin -padmin [linuxidc.com @OceanBase ~]$ mysql -h1.32.36.29 -P4797 -uadmin -padmin
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 0
Server version: 5.5.1 OceanBase 0.4.1 (r11236) (Built Jan 5 2013 16:08:48)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select * from x;
+------+------+------+------+------+
| a1 | a2 | a3 | b1 | b2 |
+------+------+------+------+------+
| 1 | 1 | 2 | 0 | 0 |
+------+------+------+------+------+
1 row in set (0.00 sec)

在OceanBase中,将sql语句写到my.sql文本文件中,,然后用重定向命令将其批量导入到mysql客户端中执行即可。

linux

ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!