php parse csv files into mysql commands
A quick script to take a .csv file, and generate some insert commands into mysql. The client hands me a spread sheet file, i drop it into a folder and run the script pretty easy.
A quick script to take a .csv file, and generate some insert commands into mysql. The client hands me a spread sheet file, i drop it into a folder and run the script pretty easy.
After changing the default password for mySQL, MAMP throws connection errors on restarting, here’s the links to go correct:
Correct path:
(from terminal) /Applications/MAMP/Library/bin/mysqladmin -u root -p password NEWPASSWORD
/Applications/MAMP/bin/mamp/index.php
/Applications/MAMP/bin/phpMyAdmin/config.inc.php
/Applications/MAMP/bin/stopMysql.sh
Helpful thread that gets into more detail:
Localizing wordpress after moving it from one domain name to another? It use to be a pain in the ass to hunt down all the link.. well it still can be. However, these mySQL find and replace commands speed it up a heck of a lot. If your theme is pretty basic, you may be done after running these.
In the commands below, Im going from my old dev address ‘studio2108.com.s52733.gridserver.com’ to my new address ‘studio2108.simplehelix.com’. Remember to back up your database before trying this.. anyway take the 4 lines below, cut them, edit them, and then paste them into phpmyadmin’s SQL tab and your good.
Whats weird is the theme file has hardcoded references to studio2108.com in the header file… im finding and replacing them for now.
update wp_posts set guid = replace(guid,'com.s52733.gridserver.com', 'simplehelix.com');
update wp_posts set post_content = replace(post_content,'com.s52733.gridserver.com', 'simplehelix.com');
update wp_options set option_value = replace(option_value,'com.s52733.gridserver.com', 'simplehelix.com');
update wp_postmeta set meta_value = replace(meta_value, 'com.s52733.gridserver.com', 'simplehelix.com');