Skip to main content

Custom MySQL Configuration Guide

WeDa Private Deployment supports connecting to custom MySQL databases to meet enterprise-level data storage and management requirements. This document will guide you through the configuration and integration of MySQL databases.

Prerequisites

Before starting the configuration, please ensure your environment meets the following requirements:

Database Version Requirements

Version Compatibility
  • MySQL Version: 8.0.30 and above (supports both standalone and cluster versions)
  • Version Limitations: MySQL 8.4 and later versions may not be compatible (due to the disabled mysql_native_password plugin)
  • Compatibility Check: It is recommended to use MySQL 8.0.30 - 8.3.x versions to ensure optimal compatibility

Permission Requirements

The MySQL user configured for connection needs to have the following permissions:

  • Table Operation Permissions: CREATE, DROP, ALTER
  • Data Operation Permissions: SELECT, INSERT, UPDATE, DELETE
  • Index Permissions: INDEX

Production Environment Recommendations

Best Practices
  • High Availability: Production environments should use cloud databases or self-built high-availability MySQL clusters
  • Avoid Docker: Not recommended to use Docker-started MySQL as production environment data storage
  • External Database: Recommended to connect to enterprise-owned external database services
  • Backup Strategy: Ensure the database has comprehensive backup and recovery mechanisms

MySQL Configuration Parameters

Basic Configuration Requirements

To ensure compatibility between WeDa Private Deployment and MySQL database, the following MySQL configurations are required. These configurations apply to MySQL 8.0 version.

Taking Tencent Cloud CDB MySQL as an example:

Configuration ItemRecommended ValueDescription
VersionMySQL 8.0 Cluster EditionProvides high availability guarantee
CPU2 cores and aboveAdjust according to business volume
Memory8GB and aboveEnsure query performance
Storage200GB and aboveEstimate based on data volume
NetworkOpen specified port access permissionsEnsure WeDa can connect

Required Configuration Parameters

Modify the MySQL configuration file (my.cnf or my.ini) and add the following configurations:

[client]
# MySQL client program configuration
default-character-set = utf8mb4

[mysql]
# MySQL command line client configuration
default-character-set = utf8mb4

[mysqld]
# MySQL server configuration
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
sql_mode = ALLOW_INVALID_DATES
explicit_defaults_for_timestamp = OFF
default-authentication-plugin = mysql_native_password
Configuration Description
  • Character Set Settings: Use utf8mb4 to ensure complete Unicode support
  • Collation Rules: utf8mb4_unicode_ci provides better internationalization support
  • Authentication Plugin: mysql_native_password ensures compatibility with WeDa
  • Timestamp Settings: Disable explicit defaults to be compatible with legacy version behavior

Standalone Version Deployment Configuration

WeDa Private Deployment standalone version provides two MySQL configuration methods: visual configuration and script configuration.

Method 1: Visual Configuration Deployment

The standalone version supports configuring external MySQL databases through a visual interface, which is simple and intuitive.

Operation Steps:

  1. Open the installer page: Access in browser: http://<Server IP>:38080

  2. Configure external MySQL: Find the external middleware configuration option in the installer page and enable MySQL configuration:

MySQL Visual Configuration

  1. Fill in database information:
    • Database host address
    • Port number (default 3306)
    • Username and password
    • Database name

Method 2: Script Configuration Deployment

Configure MySQL through configuration files, suitable for automated deployment scenarios.

Prerequisites

This configuration needs to be performed after running the installation script ./install.sh in the WeDa Deployment Process.

Step 1: Create Configuration File

vim config.yaml

Create a config.yaml file in the current directory and enter the following configuration:

## config.yaml
customMySQL:
enabled: true
host: 192.168.3.14 # MySQL server address
port: 3306 # MySQL port
username: root # Database username
password: your_password # Database password
dbName: lowcode # Main database name
dbRuntimeName: lcruntime # Runtime database name
Important Reminders
  • Network Connectivity: Ensure the entered MySQL address is accessible from the current server
  • Database Pre-creation: Databases specified by dbName and dbRuntimeName must be created in advance
  • Database Independence: The two database names cannot be the same, used for different business modules

Step 2: Create Databases

Execute the following SQL statements in MySQL to create the required databases:

-- Create main database
CREATE DATABASE `lowcode` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- Create runtime database
CREATE DATABASE `lcruntime` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Step 3: Verify Configuration

After saving the configuration file, verify that the content is correct:

cat config.yaml

After confirming the configuration information is correct, you can see output similar to the following:

Configuration File Verification

Execute Installation Deployment

Choose the corresponding deployment method based on your usage scenario:

Applicable Scenario: First time using external MySQL service

Continue with the subsequent installation steps according to the Deployment Process.

Common Problem Troubleshooting

Problem: "Access denied" prompt after executing ./install.sh

Possible Causes:

  • Incorrect MySQL connection information configuration
  • Network connectivity issues
  • Insufficient user permissions

Solutions:

  1. Check configuration file: Confirm that the MySQL connection information in config.yaml is correct
  2. Test connectivity: Use MySQL client to test connection on the current server
    mysql -h 192.168.3.14 -P 3306 -u root -p
  3. Verify permissions: Confirm that the MySQL user has necessary database operation permissions
  4. Check firewall: Ensure both server firewall and MySQL server firewall allow connections

Cluster Version Deployment Configuration

WeDa Private Deployment Kubernetes cluster version integrates external MySQL databases by modifying configuration files.

Configuration Steps

Step 1: Edit Configuration File

Prerequisites

This configuration needs to be performed after Kubernetes Cluster Version Deployment Guide downloading deployment scripts.

Edit the cluster installation configuration file config.yaml and add MySQL configuration in the middleware section:

middleware:
mysql:
## MySQL database connection information
host: your-mysql-host.com # MySQL server address
port: 3306 # MySQL port number
username: your-username # Database username
password: your-password # Database password
## Database name configuration
dbname: lowcode # Main database name
dbRuntimeName: lcruntime # Runtime database name
Configuration Requirements
  • Database Independence: dbname and dbRuntimeName cannot use the same database name
  • Database Pre-creation: Ensure specified databases are already created in MySQL
  • Network Connectivity: Ensure Kubernetes cluster can access MySQL server
  • User Permissions: Database user needs to have complete table operation permissions

Step 2: Create Databases

Execute the following SQL statements in the MySQL server:

-- Create main database
CREATE DATABASE `lowcode` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- Create runtime database
CREATE DATABASE `lcruntime` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- Grant user permissions (adjust according to actual username)
GRANT ALL PRIVILEGES ON lowcode.* TO 'your-username'@'%';
GRANT ALL PRIVILEGES ON lcruntime.* TO 'your-username'@'%';
FLUSH PRIVILEGES;

Step 3: Execute Deployment

After configuration is complete, run the deployment command:

./wedaCli up