#mysql #powershell #windows-administration
Вопрос:
Я пытаюсь настроить драйвер ODBC для подключения к базе данных MySQL в Windows Server 2016. Обычно мы настраиваем конфигурацию источника данных ODBC в MYSQL Connector вручную, как показано на рисунке ниже.
и выберет некоторые соединения и курсор/результаты, как показано ниже
Finally select OK to make available in System Data Sources. Now i trying to configure this things by powershell script or commands. However, i tried one method as below.
$odbcname="TestModel"
$mysqlserver="example.rds.amazonaws.com"
$mysqldb="TestModel"
$OdbcDriver = Get-OdbcDriver -Name "MySQL ODBC 5.2 Unicode Driver" -Platform 32-bit
Add-OdbcDsn -Name $odbcname -DriverName $OdbcDriver.Name -Platform 32-bit -DsnType
System -SetPropertyValue
@("Server=$mysqlserver",Trusted_Connection=Yes","Database=$mysqldb")
No luck. I had a look at more documents. But i couldn’t able to achieve this. I need to configure all the things such as server name, user name amp; password, then select the database and configure connections and results by using powershell script. Can any one please advice on this?