다음을 통해 공유


Web Deploy dbMySql Provider

Applies To: Windows 7, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP

dbMySql

The dbMySql provider deploys a MySQL database.

Example

msdeploy.exe -verb:sync -source:dbMySql=C:\MySQLScript.sql -dest:dbMySql="Server=localhost;Database=db2;Uid=userName;Pwd=password;"

The dbMySql provider uses the MySQL .NET assembly to execute a MySQL script against a specified destination database.

Note

The dbMySql provider cannot be used for initial deployment of a MySQL database to an empty database, or to dump a MySQL database to a script file in the same way that the dbFullSql provider can with SQL databases. For information about a custom dbFullMySql provider that can perform these tasks for MySQL databases, see Web Deploy Sample Custom Provider to sync MySQL databases (dbFullMySql).

Arguments

The dbMySql provider accepts the following arguments.

  • The file path of a MySQL script file (for example, "C:\mydirectory\MySQLdb.sql").

  • A connection string to a MySQL database site path (for example, "server=localhost;database=db1;").

dump

In a dump operation, the path of the specified database script will be returned. If you specify the -xml operation setting, the results are returned in XML format and include attribute information for the specified script file.

sync

In a sync operation, the provider executes the MySQL script that you specify in the source path against the MySQL connection string that you specify for the destination.

Provider settings

The dbMySql provider has the following provider settings.

Setting Description

commandDelimiter

A user-defined character or string of characters that separates commands in a source SQL script that synchronizes to a destination database. This setting has no effect in a "script-out" scenario (that is, when a SQL script is the destination).

commandTimeout

An integer that specifies the time, in seconds, that Web Deploy waits for the dbMySQL provider to complete its operations. The default value is 30.

createDBConnectionString

A connection string used to create the database if it does not exist. If the destination database does not exist and no value has been specified for createDBConnectionString, dbFullSql will attempt to create it by using the connection string specified in the path.

includeData

A Boolean value that indicates whether data is scripted. True if data is scripted; otherwise, false.

includeSchema

A Boolean value that indicates whether the schema is scripted. True if the schema is scripted; otherwise, false.

removeCommandDelimiter

A Boolean value. Set removeCommandDelimiter to true if you want the delimiter specified by the commandDelimiter setting to be removed from a source SQL script before the script is run against a destination database connection. If the delimiter that you have specified is not part of the SQL language, you must remove it from the script before executing the script (for example, "GO" is not part of the SQL language). This setting has no effect in a "script-out" scenario (that is, when a SQL script is the destination). The default is true.

transacted

A Boolean value. True if all changes made to the destination database will be rolled back if an error occurs during synchronization; otherwise, false. You may need to set this option to false if your script contains full-text catalogs or other commands that cannot be transacted. The default is true.

Important
The transacted setting applies only when the script is the source of the command. It does not apply when you specify a script as the destination (that is, when the script is the output created from an existing database source).

waitAttempts

Specifies the number of times the provider will wait to retry after a failure. The default number is 5. By default, there is a delay of one second between each attempt.

waitInterval

Specifies, in milliseconds, the interval between retry attempts. The default is 1000 (one second).

Specifying the MySQLDump.exe path in the registry

The dbMySql provider uses the Mysqldump.exe file to script a database, or to synchronize two MySQL databases. This file is typically located in the Program Files folder (for example, %ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysqldump.exe). You can specify the location of the Mysqldump.exe file by using the following key in the registry.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1\MySqlDumpPath

Example usages

1) Display the path and attribute information of a MySQL script file.

msdeploy.exe -verb:dump -source:dbmysql=c:\MySqlDb.sql -xml

2) Run the MySQL script specified by the source against the database MySqlDb2.

msdeploy.exe -verb:sync -source:dbmysql="C:\MySqlDb.sql" -dest:dbmysql="server=localhost;database=MySqlDb2;"

3) Run the MySQL script specified by the source against the database MySqlDb2, specifying a user id and password for the destination.

msdeploy.exe -verb:sync -source:dbmysql="C:\MySqlDb.sql" -dest:dbmysql="server=localhost;database=MySqlDb2;uid=123;password=zyxz;"