Sign inSign up

kl3x/mysql-mecab

By kl3x

Updated 25 days ago

Image
0

1.2K

kl3x/mysql-mecab repository overview

MySQL with MeCab Docker Image

简体中文

Docker Image CI

This repository contains the necessary files to build a Docker image based on mysql:8.4-debian that includes the MeCab Full-Text Parser Plugin. This allows for Japanese full-text searching capabilities within MySQL.

Prerequisites

Building the Image Locally

  1. Clone this repository:
    git clone https://github.com/stupidloud/mysql-with-mecab.git
    cd mysql-with-mecab
    
  2. Build the Docker image:
    docker build -t mysql-mecab:latest .
    
    (Note: The first build might take a while as it needs to download the MySQL source code and compile the plugin.)

Using the Image

You can use this image like any other MySQL image. Here's an example using docker run:

docker run --name some-mysql-mecab -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql-mecab:latest

Or in a docker-compose.yml file:

services:
  db:
    image: mysql-mecab:latest # Use the locally built image or replace with your published image (e.g., your-dockerhub-username/mysql-mecab:latest)
    container_name: mysql_with_mecab
    environment:
      MYSQL_ROOT_PASSWORD: your_root_password
      MYSQL_DATABASE: your_database
      MYSQL_USER: your_user
      MYSQL_PASSWORD: your_password
    volumes:
      - ./mysql_data:/var/lib/mysql
    ports:
      - "3306:3306"
    restart: always

When MySQL service starts, the MeCab plugin is automatically loaded (via the plugin-load configuration). You can verify the installation by connecting to the MySQL instance and running:

SHOW PLUGINS LIKE 'mecab';

Automated Builds (GitHub Actions)

Files

  • Dockerfile: Defines the multi-stage build process for the image.
  • mecab.cnf: MySQL configuration file that uses the plugin-load parameter to automatically load the MeCab plugin when the server starts.

Tag summary

Content type

Image

Digest

sha256:bc03661bf

Size

277.2 MB

Last updated

25 days ago

docker pull kl3x/mysql-mecab