Step 5: Deploy MySQL Database
Video Guide
5.1 Create a New App
- Login to your Caprover dashboard by visiting
https://captain.apps.yourdomain.com
, replaceyourdomain.com
with your actual domain. - In the Caprover dashboard, click on Apps in the left menu.
- Navigate to One-Click Apps/Databases.
- Search for or select MySQL from the list of available apps.
- Fill in the required details:
- App Name: (e.g.,
mysql-db
) - MySQL Root Password: Choose a strong password.
- MySQL Version: Prefer the LTS version for stability.
- App Name: (e.g.,
- Click Deploy to initiate the process.
5.2 Access Database Credentials
- After the deployment is complete, return to the Apps section.
- Click on your newly created
mysql-db
app. - Navigate to App Configs to set up the port mapping. Add the necessary port, then click Save and Restart to apply the changes.
- Next, Go to HTTP Settings:
- Remove the option to not expose as a web app.
- Enable HTTPS for secure connections.
- Save & Restart to Apply Changes
5.3 Connect to Your MySQL Database
- Use a MySQL client like MySQL Workbench or any other MySQL Client to connect from your application using the following credentials:
- Hostname: Displayed in HTTP Settings beside Enable HTTPS.
- Port:
3306
(the default MySQL port).
- Hostname: Displayed in HTTP Settings beside Enable HTTPS.
- Create a new connection using the credentials you set earlier.
- After successfully setting up the connection, import your database file (e.g.,
restropro_saas.sql
). Which is provided in the zip file that you downloaded.
Congratulations! Your MySQL database has been successfully deployed and is ready for use. Enjoy managing your data with ease!
5.4: Add SuperAdmin User
To create superadmin user, first you will need to create encrypted password. to do so visit bcrypt-generator and set the number of rounds to 10
. Use this generated password in the insert query.
In the below given SQL Query, replace the following details:
YOUR_EMAIL
YOUR_ENCRYPTED_PASSWORD
YOUR_NAME
INSERT INTO `superadmins`
VALUES
(
'YOUR_EMAIL',
'YOUR_ENCRYPTED_PASSWORD',
'YOUR_NAME'
);
Now open your MySQL Client, and paste & run this query.
🎉 You’ve successfully created superadmin user. to access the SuperAdmin Dashboard, your superadmin URL will look like this https://yourdomain.com/superadmin
However, we still have Backend and Frontend setup pending so the URL will not be accessible yet.