What's the easiest way to import a new table i

2020-07-30 03:05发布

I'm running MySQL 5 on a linux server on my local network. Running windows XP for my desktop. Had a look at the MySQL GUI Tools but I dont think they help. I cannot install apache on the remote server & use something like PHPmyAdmin.

标签: mysql csv
9条回答
兄弟一词,经得起流年.
2楼-- · 2020-07-30 03:30

I use SQLyog on my Windows system which has a free Community Edition and has an option to import from CSV.

I've never used this option myself so I can't tell you how good it is. However, SQLyog has been great for all the other things I've used it for.

查看更多
\"骚年 ilove
3楼-- · 2020-07-30 03:33

I would use a spreadsheet editor to make a set of SQL statements. Put a new column at the start and add insert into tablename values(' . Add other columns to seperate the data with code like '','. Finish with ''); . Use the autofill feature to drag these cells down to as many rows as necessary. Copy the entire sheet to a plain text editor and remove the excess tabs, leaving you with a simple set of insert statements.

This is a solution that I can use for any database system and any spreadsheet file format. Plus it is easy to populate the spreadsheet from sources such as other databases, or copying and pasting from a webpage. It's also quite fast and available from any desktop machine, using Excel, OpenOffice or Google Docs.

See my example spreadsheet in Excel and OpenOffice versions.

查看更多
太酷不给撩
4楼-- · 2020-07-30 03:40

Write a simple Python script that parses the CSV and inserts it into the table.

Look at the csv and mysqldb module.

查看更多
登录 后发表回答