Once your MySQL hosting is setup at ScaleGrid, you can easily connect to your new deployment using a shell terminal and your command line syntax. Follow these instructions to connect via the command line interface (CLI):
The MySQL client is available on the instances that your database cluster is hosted on. If you have SSH access to the underlying instances, you can access the MySQL client available on them.
Download and install the MySQL command line client on your Linux host by selecting a suitable platform and version (GA release of 5.7 series) from the Download MySQL Community Server page. Specifically, you need to install the mysql-community-client package and any dependent packages.
Download and install the MySQL command line client on your Windows host by downloading MySQL Workbench for Windows. Thus will also install the MySQL command line client which can be found in the workbench installation folder.
Here's what you need to connect your MySQL deployment using the CLI:
- User credentials - Follow the steps to create a new MySQL database user if you haven't already created one.
The command line syntax for connecting to the MySQL deployment using the admin user credentials is provided on the ScaleGrid console under the Overview tab:
In general, the command line syntax is built in the following format:
mysql -u [username] -p’[password]’ -h [host] -P 3306
In this example, we use the credentials of the MySQL admin user - 'sgroot' to connect:
mysql -u sgroot -p -P 3306 -h SG-mysqlconfig-308-master.servers.mongodirector.com
If you would like to verify the server CA certificate, you will need the SSL CA certificate file.
It is available on the Overview tab of your Cluster Details page under the SSL Certificate section as shown below:
Here's an example of a command line syntax for connecting to the master server of a master-slave set with SSL:
mysql -u sgroot -p -P 3306 -h SG-prod5725-908-master.servers.mongodirector.com --ssl-mode=VERIFY_CA --ssl_ca=<Path to ca.pem file>
The SSL CA certificate file pointed to in the ssl_ca argument above is the aforementioned SSL CA certificate file. Please note that if you do not require the verification of the server CA certificate, you do not need to specify the ssl-mode and ssl-ca arguments above, and the MySQL client by default connects with SSL enabled.
Connecting to MySQL without CA certificate verification
You will be able to connect to your SSL enabled MySQL deployment without needing to verify the CA certificate. In this case, you do not need to down load the SSL CA certificate file. Use the command line syntax below to connect.
mysql -u sgroot -p -P 3306 -h SG-prod5725-908-master.servers.mongodirector.com --ssl-mode=REQUIRED
Updated almost 2 years ago