Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Latest commit

 

History

History
108 lines (74 loc) · 2.35 KB

README.md

File metadata and controls

108 lines (74 loc) · 2.35 KB

MySQL Server Management on Project IDX

This repository contains scripts for managing MySQL server instances on Project IDX workspaces. The provided scripts allow you to start and stop MySQL server easily.

Note

If run MariaDB is enough for You. Add services.mysql below your packages.

Update 6 June 2024. Now you can run MySQL or MariaDB as service on Project IDX.

  packages = [
    ...
  ];

  # See: https://wiki.nixos.org/wiki/Mysql
  services.mysql = {
    enable = true;
    package = pkgs.mariadb;
    # package = pkgs.mysql80; # For MySQL 8.0
  };

  # Sets environment variables in the workspace
  env = {};

Thank for the insight through this video.

Getting Started

To use these scripts, see the video or follow the instructions below:

Prerequisites

Before using these scripts, ensure you have the following installed:

  • MySQL Server: Make sure MySQL server is installed on your workspace.

  • Git: Install Git on your workspace to clone this repository.

Installation

  1. Install MySQL on Project IDX by editing the dev.nix file in the .idx folder, add pkgs.mysql80 to the packages list:

    packages = [
        # other packages
        pkgs.mysql80
    ];
  2. Clone this repository to your local machine:

    git clone https://github.com/arifnd/mysql-project-idx.git mysql

Usage

Starting MySQL Server

To start the MySQL server, run the following command:

./mysql/start.sh

If you want to force start the server, you can use the --force option:

./mysql/start.sh --force

If you want to start the server in the background, use the -d option:

./mysql/start.sh -d

Get MySQL Server Status

To get the MySQL server status, run the following command:

./mysql/status.sh

Login to MySQL Server

To login to MySQL server, run the following command:

mysql -S mysql/data/mysql.sock -u root -p

password 123456

Stopping MySQL Server

To stop the MySQL server, run the following command:

./mysql/stop.sh

Running the command above will delete your MySQL data.

License

This project is licensed under the MIT License - see the LICENSE file for details.