Just upgrade your V4 to V5 instead of starting fresh.
If you really don’t want to do this, for whatever reason you want a fresh V5 install, I would suggest the best way to get that data out from V4 database is actually to upgrade it to V5 then use the Data Export feature under Reports. You can create a report to export the customer records to CSV.
This is the best approach, because customer data is stored in JSON within the SQL table, and it’s not easy to extract.
Also, there was a similar post to yours a few days ago, there are some other options for getting the data out from JSON formatted fields if you really don’t want to upgrade the database to V5 to use data export feature, but I don’t see any reason why you wouldn’t want to. Remember you can just take a backup of your V4 database beforehand then you always have it prior to upgrade.