title: MySQL Dump with PowerShell
body: <pre><code>$mysqlpath = "C:\Program Files\MySQL\MySQL Server 5.6\bin"
  $backuppath = "C:\Users\Tiffany\Downloads"
  $username = "user"
  $password = "123123"
  $database = "db"
  $errorLog = "error_dump.log"
  
  $date = Get-Date
  $timestamp = "" + $date.day + $date.month + $date.year + "_" + $date.hour + $date.minute
  
  $backupfile = $backuppath + $database + "_" + $timestamp +".sql"
  
  CD $mysqlpath
  .\mysqldump.exe --user=$username --password=$password --log-error=$errorLog --result-file=$backupfile --databases $database
  
  CD $backuppath
  $oldbackups = gci *.sql*
  
  for($i=0; $i -lt $oldbackups.count; $i++){
      if ($oldbackups[$i].CreationTime -lt $date.AddMonths(-1)){
          $oldbackups[$i] | Remove-Item -Confirm:$false
      }
  }
  </code></pre>
  
  <p>However, I keep getting the following:</p>
  
  <pre><code>mysqldump.exe : Warning: Using a password on the command line interface can be insecure.
  At C:\Users\Tiffany\Desktop\mysqldump.ps1:14 char:16
  + .\mysqldump.exe &lt;&lt;&lt;&lt;  --user=$username --password=$password --log-error=$errorLog --result-file=$backupfile --databases $database
      + CategoryInfo          : NotSpecified: (Warning: Using ...an be insecure.:String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
  </code></pre>
  
  <p>Do I need to set a flag to allow this commandline?</p>