Archive - June 2010

1
PowerShell, MySQL Command-Line, and mysqldump Restore Issues
2
Architecture Mismatch In Connection Between SQL 2008 and MySQL ODBC
3
Mid-Year Recap

PowerShell, MySQL Command-Line, and mysqldump Restore Issues

Today’s fun involved trying to restore a mysql dump file. I’m integrating this into an existing process that happens to be a PowerShell script. First, I worked out the appropriate command via the MySQL Command Line Tool to import some data that I needed to work with. The result was that I tried to add something similar to the following into my PowerShell script:

mysql -u root -p[root_password] [database_name] < dumpfile.sql

Running this command in PowerShell, I was given this lovely error message.

The '<' operator is reserved for future use.

I’m not an expert PowerShell coder. I try my hand at it to get things done, but I don’t study it regularly. I pretty much know that if I need to do task A, there’s probably a command for it that I just need to get syntactically correct. I expect to put that command in a window that is supposed to run commands and I expect it to work. Apparently, the ‘<‘ operator is called a “redirection operator” and PowerShell doesn’t support them in this way. I had no concept of “redirection operator” before today. It’s still a fuzzy concept.

In the end, I found two solutions to my problem. One of them was good and one was not. First, here’s what you don’t want to do:

Get-Content dumpfile.sql | mysql -u root -p[root_password] [database_name]

This will cause your entire file to get loaded into an object that can be manipulated in local memory. Fine if you know your file is small, but bad if your file is large. My file is 300+ MB. Instead, try this:

&cmd /c "mysql -u root -p[root_password] [database_name] < dumpfile.sql"

This basically runs this command as though you typed it in the command line. It was much faster.

P.S – Thank you, Luke, for helping me figure this out.

Architecture Mismatch In Connection Between SQL 2008 and MySQL ODBC

Spent too much time this morning troubleshooting this error when attempting to setup a linked server in SQL 2008 Express to a MySQL database.

Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "LINKEDSERVERNAME".
OLE DB provider "MSDASQL" for linked server "LINKEDSERVERNAME" returned message "[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application". (.Net SqlClient Data Provider)

The simple solution to my problem was to uninstall my 32-bit driver and instead install the 64-bit Connector/ODBC driver. For those of you looking for additional help on how to configure a linked server connection to MySQL, see HOWTO: Setup SQL Server Linked Server to MySQL and How to create a Link Server for mySQL in SQL Server Management Studio (SSMS) in SQL Server 2005.

Mid-Year Recap

Biggest achievements of the year so far:

  • 4 new ASP.net MVC apps
  • 2 enhanced PHP apps
  • 1 website launched
  • 1 new job as rock star [web developer]
  • 1 trip to Jersey to visit new niece
  • 1 mommy-son trip to Branson

Goals for the rest of the year*:

  • Continue to rock the projects at work
  • Develop an Android app and put on market
  • Find something with OS X and port Android app to Objective-C
  • Complete at least one more side web development projects
  • Hot air balloon ride this fall sounds nice (sans kids)
  • Weekend trips with the kids
  • Vacation with the hubby
  • Chill

*subject to change

Copyright © 2016, Abby Sims