+61
-0
lines changedFilter options
+61
-0
lines changed Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ use Windows named pipes from the Windows Subsystem for Linux (WSL).
7
7
For example, you can:
8
8
9
9
* Connect to Docker for Windows from the Linux Docker client in WSL
10
+
* Connect to MySQL Server running as a Windows service
10
11
* Connect interactively to a Hyper-V Linux VM's serial console
11
12
* Use gdb to connect to debug the kernel of a Hyper-V Linux VM
12
13
@@ -105,6 +106,45 @@ $ sudo adduser <my_user> docker
105
106
106
107
Then open a new WSL window to reset your group membership.
107
108
109
+
## Connect to MySQL Server running as a Windows service
110
+
111
+
If you run MySQL Server as a Windows service, you can configure it to
112
+
communicate through TCP, named pipes or shared memory. If you use named
113
+
pipes, connecting to MySQL from WSL is very similar to connecting
114
+
to Docker.
115
+
116
+
The `mysqld-relay` script is designed to be run in a `sudo` shell.
117
+
Before creating the relay, it will try to configure your environment
118
+
(if it has not been configured yet) by:
119
+
120
+
* creating `/var/run/mysqld/`,
121
+
* creating a `mysql` group, and
122
+
* adding your user account to the `mysql` group.
123
+
124
+
You can of course pull out just the npiperelay command if you don't
125
+
need any of the above checks.
126
+
127
+
Note that if you need to enter a password for sudo, the following
128
+
command will fail because of the lack of password input:
129
+
130
+
```bash
131
+
$ sudo mysqld-relay &
132
+
```
133
+
134
+
In that case, you can run it like this:
135
+
136
+
```bash
137
+
user@machine:~$ sudo -s
138
+
[sudo] password for user:
139
+
root@machine:~# mysqld-relay &
140
+
root@machine:~# exit
141
+
user@machine:~$ _
142
+
```
143
+
144
+
Now you can use the Linux `mysql` command line client or any other
145
+
Linux process that expects to talk to MySQL Server through
146
+
`/var/run/mysqld/mysqld.sock`.
147
+
108
148
## Connecting to a Hyper-V Linux VM's serial console
109
149
110
150
If you have a Linux VM configured in Hyper-V, you may wish to use its serial
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
1
+
#!/bin/sh
2
+
3
+
if [ -z "${SUDO_USER+x}" ]; then
4
+
echo "mysqld-relay must be run via 'sudo'"
5
+
exit 1
6
+
fi
7
+
8
+
if [ ! -e /var/run/mysqld ]; then
9
+
mkdir /var/run/mysqld
10
+
fi
11
+
12
+
if [ ! $(getent group exists mysql) ]; then
13
+
groupadd mysql
14
+
fi
15
+
16
+
if $(id -Gn $SUDO_USER | grep -qv '\bmysql\b'); then
17
+
usermod -aG mysql $SUDO_USER
18
+
echo "*** Log out and back in to enable 'mysql' group membership ***"
19
+
fi
20
+
21
+
exec socat UNIX-LISTEN:/var/run/mysqld/mysqld.sock,fork,group=mysql,umask=007 EXEC:"npiperelay.exe -ep -s //./pipe/MYSQL",nofork
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4