I have a table with already filled data :
Table routeur_su
+--------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+--------------+------+-----+---------+-------+
| hostname | varchar(64) | NO | PRI | NULL | |
| code_site | varchar(64) | NO | MUL | NULL | |
| ip | varchar(64) | NO | | NULL | |
| ios | varchar(64) | YES | | NULL | |
| modele | varchar(64) | YES | | NULL | |
| uptime | datetime | YES | | NULL | |
| date_polling | datetime | YES | | NULL | |
+--------------------------------------------------+-----------+-----------------+------+--------+--------+
| hostname | code_site | ip | ios | modele | uptime |
+--------------------------------------------------+-----------+-----------------+------+--------+--------+
| <hostname> | 131123S0 | 126.x.x.x | NULL | NULL | NULL |
+--------------------------------------------------+-----------+-----------------+------+--------+--------+
And I have a .csv file, that contains :
<hostname>;1/2/24 17:14:00;Cisco 1803
(the 2 others infos are the uptime and the model)
I want MySQL to update the row with the uptime and the model. For that, i used this in a BASH script :
version_router_su_file="$DIR/working-dir/shver.csv"
db_routeur_table="routeur_su"
...
$mysql -h $db_address -u $db_user -p$db_passwd $db_name -e "load data local infile '$version_router_su_file' INTO TABLE $db_routeur_table fields terminated by ';'(hostname, uptime, modele) ;"
But nothing happens. I read the documentation about load data, and tried several things but... still not working. I don't get any error with this code, it just don't update.
Creating a duplicate table like posted in MySQL LOAD DATA INFILE with ON DUPLICATE KEY UPDATE Will consume a lot of resources when doing it for each table in my database. Isn't it any other way to do it ?