diff --git a/content/anvil/connecting_to_mysql.md b/content/anvil/connecting_to_mysql.md new file mode 100644 index 0000000000000000000000000000000000000000..74817bbc512e4ffcd25c0554756ef10f5a10a69a --- /dev/null +++ b/content/anvil/connecting_to_mysql.md @@ -0,0 +1,143 @@ ++++ +title = "Connecting to MySQL instances" +description = "How to connect to MySQL-based instances" ++++ + +{{% notice info %}} +This guide assumes you associated your SSH Key Pair with the instance +when it was created, and that you are connected to the [Anvil VPN]({{< relref "connecting_to_the_anvil_vpn" >}}). +{{% /notice %}} + +The MySQL image HCC provides is a CentOS 7 image with MySQL (MariaDB) installed +and configured to allow remote access for a MySQL user named `root`. +Access to MySQL is provided via this `root` user and a random password. When +the instance is created, the password is set randomly using your +SSH Key Pair. This password can be retrieved via the Dashboard web +interface, and is then used to login to MySQL. + +{{% notice info %}} +The `root` user is for connecting to MySQL only. Access via SSH is the same +as other CentOS-based images, using the `centos` user and SSH keys. Refer to +the instructions for [Windows]({{< relref "connecting_to_linux_instances_from_windows" >}}) +or [Mac]({{< relref "connecting_to_linux_instances_from_mac" >}}) as needed. +{{% /notice %}} + +This guide assumes you have already created an instance using the `MySQL Server` image. +In order to access the database, two additional steps are required. A +_Security Group_ must be created in OpenStack to allow access to the MySQL port, +and the randomly generated password must be recovered. + +### Create and attach a security group + +Log into the Anvil web dashboard at [anvil.unl.edu](https://anvil.unl.edu) using +your HCC credentials. On the left-hand side navigation menu, +click *Access & Security*. + +{{< figure src="/images/13599031.png" >}} + +The *Security Groups* tab should already be selected. Click the *Create Security Group* button +in the upper right. + +{{< figure src="/images/security_groups_1.png" width="900" >}} + +A new window will open. Type in "MySQL" for the *Name* and then click *Create Security Group* to +save and close the window. + +{{< figure src="/images/security_groups_2.png" width="600" >}} + +Next, click *Manage Rules* for the newly created *MySQL* group. + +{{< figure src="/images/security_groups_3.png" width="900" >}} + +The details page for the group will open. Click the *Add Rule* button in the upper right. + +{{< figure src="/images/security_groups_4.png" width="900" >}} + +In the new window, open the *Rule* drop-down menu and select *MYSQL*. Click *Add* to finalize +the selection and close the window. + +{{< figure src="/images/security_groups_5.png" width="600" >}} + +You should now be returned to the details page for the security group. Verify that the +MYSQL rule is listed. + +{{< figure src="/images/security_groups_6.png" width="900" >}} + +Click the *Instances* button on the left, and locate your MySQL Server instance in the +list. Open the drop-down menu on the far right, and choose *Edit Security Groups*. + +{{< figure src="/images/security_groups_7.png" width="150" >}} + +A new window will open with the available security groups on the left, and the active ones +for the instance on the right. Click the `+` sign next to the *MySQL* group to add it to +your instance. + +{{< figure src="/images/security_groups_8.png" width="600" >}} + +It will move from the left side to the right. +Now click *Save* to apply the changes and close the window. + +{{< figure src="/images/security_groups_9.png" width="600" >}} + +You can now connect to the MySQL server in your instance. + +### Recover the MySQL password +Once your instance is running, login to the Anvil web dashboard +at [anvil.unl.edu](https://anvil.unl.edu) and click the *Instances* menu option on left-hand side. +You should see an entry for your instance similar to the following: + +{{< figure src="/images/sql_server_1.png" width="900" >}} + +Click the down arrow next to *Create Snapshot* to open the drop-down +menu and select *Retrieve Password*: + +{{< figure src="/images/13042846.png" height="400" >}} + +This will open a new pop-up window where you will need to select +your **private** SSH key file. Click the *Choose File* button to open a +file explorer window. + +{{< figure src="/images/13042857.png" width="600">}} + +Navigate to your private key file and choose to open the file. The +large text box should now have the contents of your private key. Click +the *Decrypt Password* button: + +{{< figure src="/images/13042860.png" width="600" >}} + +The randomly generated password should appear in the *Password* field. + +{{< figure src="/images/13042862.png" width="600" >}} + +Copy and paste this password into a convenient text editor. + +### Connecting to MySQL + +Determine the IP address of your instance by looking at the fourth +column entry on the *Instances* page: + +{{< figure src="/images/sql_server_2.png" width="900" >}} + +Using the username `root` along with the recovered password and the IP +address, you can now connect to MySQL using the program of your choice. + +For example, using the command line client: + +{{< highlight bash >}} +[demo20@login ~]$ mysql -u root -h 10.71.104.142 -p +Enter password: +Welcome to the MySQL monitor. Commands end with ; or \g. +Your MySQL connection id is 6 +Server version: 5.5.65-MariaDB MariaDB Server + +Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + +Oracle is a registered trademark of Oracle Corporation and/or its +affiliates. Other names may be trademarks of their respective +owners. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + +mysql> +{{< /highlight >}} + diff --git a/static/images/security_groups_1.png b/static/images/security_groups_1.png new file mode 100644 index 0000000000000000000000000000000000000000..1801e80daa8a92b413c7479856bca50e6c7f260f Binary files /dev/null and b/static/images/security_groups_1.png differ diff --git a/static/images/security_groups_2.png b/static/images/security_groups_2.png new file mode 100644 index 0000000000000000000000000000000000000000..ee912d064b403946eb44f7ae1757fe3b92304fa1 Binary files /dev/null and b/static/images/security_groups_2.png differ diff --git a/static/images/security_groups_3.png b/static/images/security_groups_3.png new file mode 100644 index 0000000000000000000000000000000000000000..819518b4341f8f9ca3faafe514d82c413b25ec6d Binary files /dev/null and b/static/images/security_groups_3.png differ diff --git a/static/images/security_groups_4.png b/static/images/security_groups_4.png new file mode 100644 index 0000000000000000000000000000000000000000..af123d2bd630f246d26a3c5103a473d3e95c6f09 Binary files /dev/null and b/static/images/security_groups_4.png differ diff --git a/static/images/security_groups_5.png b/static/images/security_groups_5.png new file mode 100644 index 0000000000000000000000000000000000000000..98edc5a316f7ed1918f101aa6d63511ad0d6037c Binary files /dev/null and b/static/images/security_groups_5.png differ diff --git a/static/images/security_groups_6.png b/static/images/security_groups_6.png new file mode 100644 index 0000000000000000000000000000000000000000..4285ebbc1a1348d85a59118edd83704107f75daf Binary files /dev/null and b/static/images/security_groups_6.png differ diff --git a/static/images/security_groups_7.png b/static/images/security_groups_7.png new file mode 100644 index 0000000000000000000000000000000000000000..92e6c2ea42f310395f83a3c4b74577b8b6c6ed02 Binary files /dev/null and b/static/images/security_groups_7.png differ diff --git a/static/images/security_groups_8.png b/static/images/security_groups_8.png new file mode 100644 index 0000000000000000000000000000000000000000..290995c0dd22ec00a94be18f61df7c74bf01c074 Binary files /dev/null and b/static/images/security_groups_8.png differ diff --git a/static/images/security_groups_9.png b/static/images/security_groups_9.png new file mode 100644 index 0000000000000000000000000000000000000000..9758a4261ab8a51e4d610fd11afde48618d039ae Binary files /dev/null and b/static/images/security_groups_9.png differ diff --git a/static/images/sql_server_1.png b/static/images/sql_server_1.png new file mode 100644 index 0000000000000000000000000000000000000000..905240feb0e538af594c02834ad4d98ccb48bfd8 Binary files /dev/null and b/static/images/sql_server_1.png differ diff --git a/static/images/sql_server_2.png b/static/images/sql_server_2.png new file mode 100644 index 0000000000000000000000000000000000000000..312ae2306819c3fac2e98064478394fb141de6d1 Binary files /dev/null and b/static/images/sql_server_2.png differ diff --git a/static/markdown/anvil-images.md b/static/markdown/anvil-images.md index 41826541bbb1e1514b15658ea4f73c69b942c45a..0fca652f91ee1a14eb054f00f61d71bec6a6eef4 100644 --- a/static/markdown/anvil-images.md +++ b/static/markdown/anvil-images.md @@ -26,4 +26,4 @@ | Ubuntu Cloud 16.04 LTS | `ubuntu` | `ssh -l ubuntu <ipaddress>` | Ubuntu Cloud Image from the 16.04 Long Term Support release.| | Ubuntu Cloud 17.04 LTS | `ubuntu` | `ssh -l ubuntu <ipaddress>` | Ubuntu Cloud Image from the 17.04 Long Term Support release.| | Ubuntu Cloud 18.04 LTS | `ubuntu` | `ssh -l ubuntu <ipaddress>` | Ubuntu Cloud Image from the 18.04 Long Term Support release.| - +| MySQL Server 5.5 | `centos`/`root` | `ssh -l centos <ip address>`/[MySQL instructions](/anvil/connecting_to_mysql) | CentOS 7 based image with a pre-configured MySQL (MariaDB) server. |