简体   繁体   中英

MySQL LOAD DATA INFILE host lookup

I have a CSV file with a timestamp and a host IP address on each row.

The table I would like to load this file into, additionally has a hostname column.

I am trying to load this data using LOAD DATA INFILE. Is there a way I can lookup the hostname as the data is loaded into the table?

Also as a more general question, how can I lookup the hostname for any given IP address inside of a stored procedure, for example.

Thanks.

I don't think there is any MySQL function to lookup the hostname for a given IP address. I would suggest loading the data first and then looking up and missing hostnames using a script written in PHP, Ruby, Python, or whatever.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM