man*_*k13 4 mysql command-line
我有这个文件:
/referencias$ ls | grep .dbf
avenidas.dbf
barrios.dbf
borde.dbf
construcciones.dbf
espejo_de_agua.dbf
manchas_urbanas.dbf
manzanas.dbf
plazas.dbf
Run Code Online (Sandbox Code Playgroud)
我想做,但在终端。任何的想法?
感谢roadmr:我就是这样做的。
dbf2mysql -vv -q -h localhost -P my.password -U root avenidas.dbf -d avenidas -c
dbf-file: avenidas.dbf - dBASE III w/o memo file, MySQL-dbase: avenidas, MySQL-table: test
Number of records: 60
Name Length Display Type
-------------------------------------
NMBRE_COMP 150 0 C
TIPO 4 0 C
CODIGO 16 0 N
LOAD DATA LOCAL INFILE '/tmp/d2myCO7f7O' REPLACE INTO table test fields terminated by ',' enclosed by ''''
Run Code Online (Sandbox Code Playgroud)
之后检查MySQL。
# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 47
Server version: 5.1.58-1ubuntu1 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> USE avenidas;
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> SHOW tables;
+--------------------+
| Tables_in_avenidas |
+--------------------+
| test |
+--------------------+
1 row in set (0.01 sec)
mysql> DESCRIBE test;
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| NMBRE_COMP | varchar(150) | NO | | NULL | |
| TIPO | varchar(4) | NO | | NULL | |
| CODIGO | int(11) | NO | | NULL | |
+------------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> \q
Bye
Run Code Online (Sandbox Code Playgroud)
我找到了一个“dbf2mysql”包:
该程序采用 xBase 文件并将查询发送到 MySQL 服务器以将其插入 MySQL 表,反之亦然。
我自己还没有尝试过,但看起来它可以满足您的需求。安装(并且因为您似乎对终端很方便):
sudo apt-get install dbf2mysql
Run Code Online (Sandbox Code Playgroud)
这是联机帮助页。