You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/tutorials/connect-ssh.md
+11-14Lines changed: 11 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
lastmod: 2021-04-22
2
+
lastmod: 2021-07-05
3
3
date: 2019-07-30
4
4
menu:
5
5
main:
@@ -11,17 +11,18 @@ weight: 15
11
11
12
12
# Connecting to MySQL Server with SSH from C\#
13
13
14
-
This tutorial demonstrates how to simulate the `SshHostName`, `SshPort`, `SshUserName`, `SshPassword`, `SshKeyFile`, and `SshPassPhrase`
15
-
connection string options using MySqlConnector.
14
+
This tutorial demonstrates how to use SSH.NET and MySqlConnector to connect to a MySQL database over SSH.
16
15
17
-
The options are defined as follows:
16
+
The arguments below are defined as follows:
18
17
19
-
*`SshHostName`: (required) the host name or IP address of the SSH server
20
-
*`SshPort`: (optional) the port of the SSH server (default 22)
21
-
*`SshUserName`: (required) the user name on the SSH server
22
-
*`SshPassword`: (optional) the password of the SSH user
23
-
*`SshKeyFile`: (optional): the path to the private key file to use for SSH authentication; if specified, this option takes precedence over `SshPassword`
24
-
*`SshPassPhrase`: (optional): the passphrase to unlock the SSH private key file specified by `SshKeyFile`
18
+
*`sshHostName`: (required) the host name or IP address of the SSH server
19
+
*`sshUserName`: (required) the user name on the SSH server
20
+
*`sshPassword`: (optional) the password of the SSH user
21
+
*`sshKeyFile`: (optional) the path to the private key file to use for SSH authentication; if specified, this option takes precedence over `sshPassword`
22
+
*`sshPassPhrase`: (optional) the passphrase to unlock the SSH private key file specified by `sshKeyFile`
23
+
*`sshPort`: (optional) the port of the SSH server (default `22`)
24
+
*`databaseServer`: (optional) the host name or IP address of the database server (relative to the SSH server, default `localhost`)
25
+
*`databasePort`: (optional) the port the MySQL server is listening on (default `3306`)
25
26
26
27
## Prerequisites
27
28
@@ -70,10 +71,6 @@ public static (SshClient SshClient, uint Port) ConnectSsh(string sshHostName, st
70
71
71
72
## Example Use
72
73
73
-
The `ConnectSsh` method defines two extra parameters: `databaseServer` and `databasePort`. By default,
74
-
it assumes that the database is running on the same machine as the SSH server, using the default port (3306).
75
-
If this isn't true, use the `Server` and `Port` values from the connection string.
76
-
77
74
Note that these examples dispose `sshClient`, which shuts down the forwarded port. In practice, you will
78
75
want to keep the `SshClient` and forwarded port alive for the lifetime of your application.
0 commit comments