mazman13 Posted October 2, 2008 Share Posted October 2, 2008 Ok. So I have alot of initial data that I need to put in a database. I really don't want to add everything line by line... I know there is a way to put everything into a text file and import it. What's the best way to do this? Can I just type what I need in notepad? Put a ',' for every break and a space for every line end? What query do I need for mySQL and where do I load the file 2? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/126746-solved-help-import-text-file-into-mysql/ Share on other sites More sharing options...
GregL83 Posted October 2, 2008 Share Posted October 2, 2008 Depends on the current data format. You can use a spreadsheet and save it as a CSV file. CSV files can be imported into a database table. I use HeidiSQL. CSV files use commas and quotations to designate rows and cols. If you are starting from scratch I would put it into a spreadsheet and import each table. Quote Link to comment https://forums.phpfreaks.com/topic/126746-solved-help-import-text-file-into-mysql/#findComment-655586 Share on other sites More sharing options...
mazman13 Posted October 2, 2008 Author Share Posted October 2, 2008 Cool. I'll try that. I download HeidiSQL...I have GoDaddy for a host and it doesnt want to connect. I'm using 'p3smysql23.secureserver.net' as my host. Anyone have this problem with GoDaddy? Quote Link to comment https://forums.phpfreaks.com/topic/126746-solved-help-import-text-file-into-mysql/#findComment-655597 Share on other sites More sharing options...
GregL83 Posted October 2, 2008 Share Posted October 2, 2008 I have the same problem with my host. Some hosts force you to use phpmyadmin... Hack fix: Build your db locally (localhost). You can export your db from phpmyadmin and import it locally with heidisql. Use heidisql to import the csv to your local copy of the db. Export the db tables as sql format. Import the .sql file into phpmyadmin... Quote Link to comment https://forums.phpfreaks.com/topic/126746-solved-help-import-text-file-into-mysql/#findComment-655635 Share on other sites More sharing options...
GregL83 Posted October 2, 2008 Share Posted October 2, 2008 BTW make sure you have the correct version of mysql in your 'target compatability' setting for the heidisql export. Quote Link to comment https://forums.phpfreaks.com/topic/126746-solved-help-import-text-file-into-mysql/#findComment-655638 Share on other sites More sharing options...
mazman13 Posted October 2, 2008 Author Share Posted October 2, 2008 Yeah thats not a bad idea. I prob should get a local mySql server huh? What would you do? Apache? Quote Link to comment https://forums.phpfreaks.com/topic/126746-solved-help-import-text-file-into-mysql/#findComment-655649 Share on other sites More sharing options...
GregL83 Posted October 2, 2008 Share Posted October 2, 2008 You need to be setup locally anyways for testing. Never build live. I would use WAMP. It will install apache, php, mysql for windows (automatically). When running WAMP, your server will be localhost. Quote Link to comment https://forums.phpfreaks.com/topic/126746-solved-help-import-text-file-into-mysql/#findComment-655656 Share on other sites More sharing options...
mazman13 Posted October 2, 2008 Author Share Posted October 2, 2008 Thanks. I'll give it a try. Quote Link to comment https://forums.phpfreaks.com/topic/126746-solved-help-import-text-file-into-mysql/#findComment-655674 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.