r/SQL • u/Few_Side1517 • Oct 13 '26
MySQL Data import question
Hey so Im quite new to mysql and I've been using it on mac, and recently I've been trying to import a csv file that contain data but Im not sure how to do it. Ive seen youtube videos but the mysql version that they use is way different than mine. Can anybody help with this please and thank you.!!
0
Upvotes
View all comments
1
u/navicat-gu Oct 20 '26
The tutorials probably look different because many of them use Workbench 8.0, and the current Workbench (26.x) is a full rewrite, so some of the old menus aren't there yet. Here's a way to do it that works whatever version you have:
mysql --local-infile=1 -u root -p your_db'\r\n'. If your dates look like10/13/2026, load them into a variable and convert:(order_id,u/d, product, qty, price) SET order_date = STR_TO_DATE(@d, '%m/%d/%Y');SHOW WARNINGS;straight after the load, thenSELECT COUNT(*) FROM sales;and compare against the row count in the file.If you export from Excel on Mac, choose "CSV UTF-8" so accented characters don't get mangled.
If you'd rather use a GUI: Disclosure: I'm RC, Director of Digital Strategy @ Navicat. Navicat Premium Lite is free and includes a CSV import wizard for MySQL that lets you map file columns to table columns. In Navicat 18 the import wizard was rebuilt with a live preview, which makes date/delimiter problems easy to spot. The SQL above is still worth learning, though.