MySQL
MySQL copied to clipboard
ZeroDate
Hey! I found your awesome MySQL module via this link: https://mcpmag.com/articles/2016/03/02/querying-mysql-databases.aspx
One thing I ran into in my particular instance was the use of Zero Date Time. I had to modify the connection string in MySQL psm1 to include 'Convert Zero Datetime=True;' at the end of the string.
Just wanted to give you a heads up. It's a pretty easy MySQL bug to deal with, but in case you wanted to put that inside your module in some way, I thought I'd give you the heads up that others may find it useful as well.
Can you share the lines you changed in the script, its a pretty long file with a number of broken up query spots. Would save some troubleshooting. I am experiencing similar issues. My specific issue is
argument(s): "Incorrect datetime value: '2/26/2020 5:00:00 AM' for column
Seems that wasnt my issue, i fixed my problem with: (datetime).ToString('yyyy-MM-dd HH:MM:ss')
But maybe you can post the change anyways?
Just edit C:\Program Files\WindowsPowerShell\Modules\MySQL\MySQL.psm1 so that the connection string is
$connectionString = $connectionString + "default command timeout=$CommandTimeOut; Connection Timeout=$ConnectionTimeOut;Allow User Variables=True;Convert Zero Datetime=True"
Can someone please fix this issue in the source code for the next release?
On the new version I changed line 141 of C:\Program Files\WindowsPowerShell\Modules\MySQL\public\Connect-MySqlServer.ps1 to
$connectionString = $connectionString + "default command timeout=$CommandTimeOut; Connection Timeout=$ConnectionTimeOut;Allow User Variables=True;Convert Zero Datetime=True"