Deploy MySQL on KubeSphere
MySQL is an open-source relational database management system (RDBMS), which uses the most commonly used database management language - Structured Query Language (SQL) for database management. It provides a fully managed database service to deploy cloud-native applications using the world's most popular open-source database.
This tutorial walks you through an example of deploying MySQL from the App Store of KubeSphere.
- Please make sure you enable the OpenPitrix system.
- You need to create a workspace, a project, and a user account for this tutorial. The account needs to be a platform regular user and to be invited as the project operator with the
operatorrole. In this tutorial, you log in as
project-regularand work in the project
demo-projectin the workspace
demo-workspace. For more information, see Create Workspaces, Projects, Users and Roles.
Step 1: Deploy MySQL from the App Store
On the Overview page of the project
demo-project, click App Store in the upper-left corner.
Find MySQL and click Install on the App Information page.
Set a name and select an app version. Make sure MySQL is deployed in
demo-projectand click Next.
In App Settings, uncomment the
mysqlRootPasswordfield and customize the password. Click Install to continue.
Wait until MySQL is up and running.
Step 2: Access the MySQL terminal
Go to Workloads and click the workload name of MySQL.
Under Pods, expand the menu to see container details, and then click the Terminal icon.
In the terminal, execute
mysql -uroot -ptestingto log in to MySQL as the root user.
Step 3: Access the MySQL database outside the cluster
To access MySQL outside the cluster, you need to expose the app through a NodePort first.
Go to Services and click the service name of MySQL.
Click More and select Edit External Access from the drop-down list.
Select NodePort for Access Method and click OK. For more information, see Project Gateway.
Under Ports, you can see the port is exposed. The port and public IP address will be used in the next step to access the MySQL database.
To access your MySQL database, you need to use the MySQL client or install a third-party application such as SQLPro Studio for the connection. The following example demonstrates how to access the MySQL database through SQLPro Studio.
NoteYou may need to open the port in your security groups and configure related port forwarding rules depending on where your Kubernetes cluster is deployed.
For more information about MySQL, refer to the official documentation of MySQL.
Was this page Helpful?
Receive the latest news, articles and updates from KubeSphere
Thanks for the feedback. If you have a specific question about how to use KubeSphere, ask it on Slack. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.