diff --git a/Library/MySqlServer.cs b/Library/MySqlServer.cs
index b656a60..d5bc87a 100644
--- a/Library/MySqlServer.cs
+++ b/Library/MySqlServer.cs
@@ -17,6 +17,8 @@ public class MySqlServer
private string _dataDirectory;
private string _dataRootDirectory;
+ private int _serverPort = 3306;
+
private Process _process;
private MySqlConnection _testConnection;
@@ -162,11 +164,12 @@ public void StartServer()
{
"--standalone",
"--console",
- string.Format("--basedir=" + "\"{0}\"",_mysqlDirectory),
- string.Format("--lc-messages-dir=" + "\"{0}\"",_mysqlDirectory),
- string.Format("--datadir=" + "\"{0}\"",_dataDirectory),
+ string.Format("--basedir=\"{0}\"",_mysqlDirectory),
+ string.Format("--lc-messages-dir=\"{0}\"",_mysqlDirectory),
+ string.Format("--datadir=\"{0}\"",_dataDirectory),
"--skip-grant-tables",
"--enable-named-pipe",
+ string.Format("--port={0}", _serverPort.ToString()),
// "--skip-networking",
"--innodb_fast_shutdown=2",
"--innodb_doublewrite=OFF",
@@ -191,6 +194,16 @@ public void StartServer()
this.waitForStartup();
}
+ ///
+ /// Start the server on a specified port number
+ ///
+ /// The port on which the server should listen
+ public void StartServer(int serverPort)
+ {
+ _serverPort = serverPort;
+ StartServer();
+ }
+
///
/// Checks if the server is started. The most reliable way is simply to check if we can connect to it
///