Skip to main content

Custom MySQL Configuration Guide

Software supports custom MySQL. If you need to connect to a custom MySQL database and perform operations such as setting up a custom domain, you need to perform the following operations:

tip
  • The MySQL database must meet version 8.0.30 or later, and standalone/cluster editions are acceptable.
    • Versions after 8.4 may not be supported (mysql_native_password is disabled after version 8.4)
  • MySQL databases started with Docker lack high availability and are not recommended for production environments to store data. The platform recommends connecting to external databases owned by the user.
  • The user configured for WeDa to connect to the MySQL database must have table operation privileges (create/drop/alter)

1. MySQL Version Configuration

Take Tencent Cloud CDB as an example. The test version configuration here is as follows, and other MySQL versions can refer to the corresponding configurations.

  • The following configuration is for MySQL 8.0 cluster edition + 2 CPU cores + 8gb memory + 200GB storage. When purchasing the database, make sure to open WeDa's access to the specified port of the database.

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


[client]
default_character_set = utf8mb4

[mysql]
default-character-set=utf8mb4

[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
sql_mode = ALLOW_INVALID_DATES
explicit_defaults_for_timestamp = OFF

[mysqld]
sql_require_primary_key = OFF

2. Standalone Edition Configuration

2.1. Visual Configuration Deployment

Note

Standalone edition supports external middleware - MySQL visual deployment

Enter in the browser: http://<actual access IP>:38080 to open the installer page. As shown below, you can enable the configuration of external middleware - MySQL.

2.2. Script Configuration Deployment

Note

This step should be configured during the Deploy weda process after running the installation script ./install.sh

vim config.yaml

By default, there is no config.yaml file in the directory. Use vim to create and open it, then enter the following content:

## config.yaml
customMySQL:
enabled: true
host: 192.168.3.14
port: 3306
username: root
password: xxx
dbName: lowcode
dbRuntimeName: lcruntime
tip

Please note: Ensure that the custom mysql you entered is accessible from the current server. Both dbName and dbRuntimeName are databases used during weda runtime. Please verify that both databases you entered already exist and cannot share the same database name.

### Database Creation Statement for dbName:
CREATE DATABASE `lowcode` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
### Database Creation Statement for dbRuntimeName:
CREATE DATABASE `lcruntime` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

ii. Save the file and exit.

cat config.yaml

iii. Check whether the content of the file is correct. alt text

2.2. Installation and Deployment

  • First time using an external MySQL service, subsequent installation process is identical to the deployment process
  • If MySQL has been installed previously, run ./upgrade.sh to complete the upgrade.
    info

    The MySQL upgrade process does not perform data migration.

2.3. Troubleshooting

a. Access denied when executing ./install.sh

Check whether the mysql information input in the config.yaml file can be connected on the current machine.

3. Cluster Edition Configuration

3.1. Adding Configuration

Note

This step needs to be configured after downloading the deployment script in the Kubernetes Cluster Edition Deployment Guide.

Edit the cluster installation configuration file config.yaml

middleware:
mysql:
## mysql Database Connection Information
host:
port:
username:
password:
## Database name dbname and dbRuntimeName cannot be identical
dbname:
dbRuntimeName:

3.2. Installation and Deployment

Run the command ./wedaCli up