linuxmysql批量执⾏sql_利⽤MySQL客户端批量执⾏sql语句[linuxidc @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 @OceanBase ~]$ MySQL -h1.32.36.29 -P4797 -uadmin -padmin < my.sql
[linuxidc @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 |
linux重定向+------+------+------+------+------+
1 row in set (0.00 sec)
在OceanBase中,将sql语句写到my.sql⽂本⽂件中,然后⽤重定向命令将其批量导⼊到mysql客户端中执⾏即可。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论