{"id":17299789,"url":"https://github.com/jmrenouard/easymysql","last_synced_at":"2026-05-09T09:42:36.100Z","repository":{"id":27575137,"uuid":"31057623","full_name":"jmrenouard/easymysql","owner":"jmrenouard","description":"Helper Bash script for MySQL multi instances management","archived":false,"fork":false,"pushed_at":"2015-06-18T20:13:03.000Z","size":156,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T03:29:17.483Z","etag":null,"topics":["command-line-tool","mariadb","mysql","mysql-client","shell"],"latest_commit_sha":null,"homepage":"http://www.jmrenouard.fr/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmrenouard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-20T09:09:57.000Z","updated_at":"2023-09-08T16:54:52.000Z","dependencies_parsed_at":"2022-09-06T08:51:38.961Z","dependency_job_id":null,"html_url":"https://github.com/jmrenouard/easymysql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmrenouard%2Feasymysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmrenouard%2Feasymysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmrenouard%2Feasymysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmrenouard%2Feasymysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmrenouard","download_url":"https://codeload.github.com/jmrenouard/easymysql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245743324,"owners_count":20665090,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line-tool","mariadb","mysql","mysql-client","shell"],"created_at":"2024-10-15T11:23:43.957Z","updated_at":"2026-05-09T09:42:31.058Z","avatar_url":"https://github.com/jmrenouard.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Easymysql #\n**Helper Bash script for MySQL multi instance management on one server**\n\n# Purpose #\n This tools is a simple Bash script that help you to\n**clone and manage several MySQL server instances** \non the same server. \n It supports 6 main features:\n\n- clone\r\n- destroy\r\n- start\r\n- stop\r\n- restart    \r\n- status\r\n      \n# Prerequirements #\n1. Use a standard Linux and Bash shell\r\n    - [http://www.linux.com/directory/Distributions](http://www.linux.com/directory/Distributions \"Linux Distibution\")\r\n    - [http://www.gnu.org/software/bash/](http://www.gnu.org/software/bash/ \"Bash Shell\")\r\n2. Download mysqlutilities\n\t-  [http://dev.mysql.com/downloads/utilities/](http://dev.mysql.com/downloads/utilities/ \"MySQL Utilities\")\n3. A classic MySQL or MariaDb server\n\t- [http://dev.mysql.com/downloads/mysql/](http://dev.mysql.com/downloads/mysql/ \"MySQL Server\")\n\t- [https://downloads.mariadb.org/](https://downloads.mariadb.org/ \"MariaDB Server\")\n\n# Installation #\n\n## Installation from Git ##\n    # git clone https://github.com/jmrenouard/easymysql\n\n## Download Source from GitHub ##\n    # curl https://github.com/jmrenouard/easymysql/archive/master.zip\n    # unzip master.zip\n\n\n## Setup ##\n    # source mysql_functions.sh\n\n# Specific configurations #\n\nThis parameters are set at the begin of mysql_functions.sh script.\n## Root Directory for all instances\n    ROOT_DIR=/var/lib\n\n## Type of servers ##\n    TYPE=mysql\n\n## General options for all instances ##\n    GENERAL_OPTIONS=\"--log-bin=mysql-bin --pid-file=clone.pid --explicit_defaults_for_timestamp --plugin-dir=/usr/lib64/mysql/plugin\"\n\n## User used for running mysqld process ##\n    MUSER=mysql\n\n## Password used for root user in all instances ##\n    RPASSWORD=admin\n\n## Main MySQL configuration file ##\n    MAIN_CFG_FILE=/etc/my.cnf\n\n## Include Configuration Directory ##\n    ETC_DIR=/etc/my.cnf.d/\n\n# Basic concepts #\n## Server Identifier ##\n**Identifier** is the only concept your really need to handle all instances.\n\nFor example, MySQL instance with id=x gets the following properties:\n\n1. Port: 3306+X\r\n2. Datadir: /var/lib/mysql + X\r\n3. Server id: X\r\n4. Socket: Datadir/mysqlX.sock\n\n## Main functions ##\n\n- Clone a existing and running instance\r\n    \n        mclone \u003c ID DESTINATION \u003e [ \u003c ID SOURCE \u003e ]\n\n- Start one or several MySQL instance\n \n        mstart \u003c ID1 \u003e [ \u003c ID2 \u003e ] [ \u003c ID3 \u003e ] ...\n\n- Stop one or several MySQL instance\n \n        mstart \u003c ID1 \u003e [ \u003c ID2 \u003e ] [ \u003c ID3 \u003e ] ...\n\n- Restart one or several MySQL instance\n \n        mrestart \u003c ID1 \u003e [ \u003c ID2 \u003e ] [ \u003c ID3 \u003e ] ...\n\n- Get status of one, several or all MySQL instances\n\n        mstatus [ \u003c ID1 \u003e ] [ \u003c ID2 \u003e ] ...\n\n- Destroy one or several MySQL instance\n\n        mdestroy \u003c ID1 \u003e [ \u003c ID2 \u003e ] [ \u003c ID3 \u003e ] ...\n\n\n# Examples #\n## Cloning a instance standard 3306 instance ##\n    # source mysql_functions.sh\n    # mclone 1\n\n## Cloning MySQL instance 1 port 3307 ##\n    # source mysql_functions.sh\n    # mclone 2 1\n\n## Destroying MySQL instance 2 ##\n    # source mysql_functions.sh\n    # mdestroy 2\n\n## Getting the status of all MySQL instances ##\n    # source mysql_functions.sh\n    # mstatus\n\tID      DIRECTORY       PORT    STATUS  PID\n\tPRI     /var/lib/mysql  3306    ON      2144\n\t1       /var/lib/mysql1 3307    ON      3029\n\t2       /var/lib/mysql2 3308    ON      3048\n\n## Stopping MySQL instance 2 ##\n\t# source mysql_functions.sh\n    # mstop 2\n    # mstatus\n\tID      DIRECTORY       PORT    STATUS  PID\n\tPRI     /var/lib/mysql  3306    ON      2144\n\t1       /var/lib/mysql1 3307    ON      3029\n\t2       /var/lib/mysql2 3308    OFF\n\t\n## Starting MySQL instance 2 ##\n\t# source mysql_functions.sh\n    # mstart 2\n    # mstatus\n\tID      DIRECTORY       PORT    STATUS  PID\n\tPRI     /var/lib/mysql  3306    ON      2144\n\t1       /var/lib/mysql1 3307    ON      3029\n\t2       /var/lib/mysql2 3308    ON      3049\n\n## Restarting MySQL instances 1 2 ##\n\t# source mysql_functions.sh\n    # mrestart 1 2\n    # mstatus\n\tID      DIRECTORY       PORT    STATUS  PID\n\tPRI     /var/lib/mysql  3306    ON      2144\n\t1       /var/lib/mysql1 3307    ON      3029\n\t2       /var/lib/mysql2 3308    ON      3049\n\n## Creating  10 MySQL instances at once ##\n\t# source mysql_functions.sh\n    # for i in `seq 1 10`; do mclone $i; done\n    # mstatus\n\tID      DIRECTORY       PORT    STATUS  PID\n\tPRI     /var/lib/mysql  3306    ON      2144\n\t1       /var/lib/mysql1 3307    ON      3029\n\t10      /var/lib/mysql10        3316    ON      4018\n\t2       /var/lib/mysql2 3308    ON      3048\n\t3       /var/lib/mysql3 3309    ON      3562\n\t4       /var/lib/mysql4 3310    ON      3627\n\t5       /var/lib/mysql5 3311    ON      3692\n\t6       /var/lib/mysql6 3312    ON      3757\n\t7       /var/lib/mysql7 3313    ON      3822\n\t8       /var/lib/mysql8 3314    ON      3887\n\t9       /var/lib/mysql9 3315    ON      3952\n\n## Stopping 10 first MySQL instances ##\n\t# source mysql_functions.sh\n    # mstart `seq 1 10`\n\n## Destroying 10 MySQL instances ##\n\t# source mysql_functions.sh\n    # mdestroy `seq 1 10`\n\n## Getting a mysql client on MySQL instances 7 ##\n\t# source mysql_functions.sh\n    # mclient 7\n    mysql\u003e ...\n\n## Requesting from a mysql client on MySQL instances 4 ##\n\t# source mysql_functions.sh\n    # mclient 4 select @@server_id\n    @@server_id\r\n    4\r\n\r\n# Support easymysql script #\n## Bugs report ##\n  [https://github.com/jmrenouard/easymysql/issues](https://github.com/jmrenouard/easymysql/issues \"Fill an issue\")\r\n\r\n## Pull request ##\r\n  [https://github.com/jmrenouard/easymysql/pulls](https://github.com/jmrenouard/easymysql/pulls \"Pull Request\")\r\n\r\n## Send an email ##\r\n  jmrenouard@gmail.com\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmrenouard%2Feasymysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmrenouard%2Feasymysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmrenouard%2Feasymysql/lists"}