Skip to content

Commit

Permalink
refs
Browse files Browse the repository at this point in the history
  • Loading branch information
abdotaskies committed Aug 24, 2024
1 parent 86480a8 commit 331a7f1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mysql.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ if ($existing -eq $false) {
exit 1
}
Write-Host "Creating new MySQL user $new_user..."
$query = @"
CREATE USER '$new_user'@'%' IDENTIFIED WITH mysql_native_password BY '$new_password';GRANT ALL PRIVILEGES ON *.* TO '$new_user'@'%';FLUSH PRIVILEGES;
nerdctl exec mysql bash -c @"
mysql -u root -p$mysql_root_password -e "CREATE USER '$new_user'@'%' IDENTIFIED WITH mysql_native_password BY '$new_password';GRANT ALL PRIVILEGES ON *.* TO '$new_user'@'%';FLUSH PRIVILEGES;"
"@
$command = "nerdctl exec mysql mysql -u root -p$mysql_root_password -e `"$query`""
& {bash -c $command}
Write-Host "New MySQL user $new_user created successfully."
}

Expand Down

0 comments on commit 331a7f1

Please sign in to comment.