Sunday, April 28, 2024
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 16099  / 1 Year ago, tue, may 9, 2023, 3:00:54

I've got this files:



/referencias$ ls | grep .dbf
avenidas.dbf
barrios.dbf
borde.dbf
construcciones.dbf
espejo_de_agua.dbf
manchas_urbanas.dbf
manzanas.dbf
plazas.dbf


I want to do but in the terminal. any idea?



thanks to roadmr: this is how I did it.



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 ''''


after that checked on 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

More From » command-line

 Answers
5

I found a "dbf2mysql" package:




This program takes an xBase file and sends queries to an MySQL server
to insert it into an MySQL table and vice versa.




I haven't tried it myself but it looks like it will do what you need. To install (and since you seem to be handy with the terminal):



sudo apt-get install dbf2mysql


this is the manpage.


[#42350] Tuesday, May 9, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
issfullus

Total Points: 264
Total Questions: 126
Total Answers: 107

Location: Comoros
Member since Mon, Dec 19, 2022
1 Year ago
;