Cmdlets for MySQL

Build 24.0.9175

Update-MySQL Cmdlet

Parameters   Output Objects  

Updates MySQL data.

Syntax

Update-MySQL [parameters]

Remarks

The Update-MySQL cmdlet allows you to use a syntax similar to SQL UPDATE statements to update MySQL data.

$conn = Connect-MySQL -User 'myUser' -Password 'myPassword' -Database 'NorthWind' -Server 'myServer' -Port 3306
Update-MySQL -Connection $conn -Table "`sakila`.Orders" -Columns @("ShipCity") -Values @("Raleigh") -Id "10261"
The Where parameter can also be used to specify the primary key of the table:
Update-MySQL -Connection $conn -Table "`sakila`.Orders" -Columns @("ShipCity") -Values @("Raleigh") -Where "Id = '10261'"
The primary key can also be passed to the cmdlet along the pipeline:
Select-MySQL -Connection $conn -Table `sakila`.Orders -Where "ShipCountry = 'USA'" | Update-MySQL -Columns @("ShipCountry") -Values @("USA 2")

Copyright (c) 2025 CData Software, Inc. - All rights reserved.
Build 24.0.9175