Install MariaDB on Windows from Source Code
Tags: mariadb, windows, installation, sourcecode
Published: 2023-04-26 20:51:40

## Let's build MariaDB on Windows
---

There are few pre-requisite we need to install before even start building the server:

### 1. Visual C++

Download and Install Visual C++ from [Microsoft](https://visualstudio.microsoft.com/). Community Version 2019 and 2022 are supported at this time.

Make sure to select and install "Desktop Development with C++" during the installation process.


![Visual Code Installation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/574kwg6tz8xl994lqf96.png)

### 2. CMake

Download CMake from [cmake-v3.26.0](https://github.com/Kitware/CMake/releases/download/v3.26.0/cmake-3.26.0-windows-x86_64.msi) and install on the machine. 

- Minimum version required: 3.14 

**Check out one of my blog on** [CMake installation](https://dev.to/arun3sh/install-cmake-on-windows-4eo5) 

Make sure to add `C:\GnuWin32\bin` to your windows system path. 

Have a look at my blog [how to add program to SYSTEM PATH](https://dev.to/arun3sh/add-program-to-path-5gle)

### 3. Git

Download and Install git using [Git-2.39.2-64-bit.exe](https://github.com/git-for-windows/git/releases/download/v2.39.2.windows.1/Git-2.39.2-64-bit.exe)

**While installing git, make sure to select the PATH environment as follows:**
![Git Installation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/08hgxcmd6pcmbqroo4hs.png)



### Bison

GNU diff is a command-line tool for comparing the contents of two files or directories and highlighting the differences between them. It is part of the GNU Utilities software suite and is widely available on Unix-based operating systems, including Linux and macOS.

The main purpose of GNU diff is to help users identify differences between two text files or directories. It does this by analyzing the contents of each file or directory and highlighting the lines or sections that differ. Users can specify various options to customize the output of GNU diff, such as ignoring whitespace differences or suppressing certain types of changes.

GNU diff is a powerful and flexible tool that is commonly used in software development, system administration, and other technical fields. It can help users detect changes in code, configuration files, and other important data, and can be integrated into automated workflows to streamline various tasks.

[Install BISON on your system](https://dev.to/arun3sh/install-gnu-diffutils-on-windows-57j8)

## Build

- Get the source code

You will be able to find the source code of MariaDB from their GitHub repo [MariaDB Github Repository](https://github.com/MariaDB/server) 

- Clone the repo to your system

```bash
git clone git@github.com:MariaDB/server.git 
```

After the clone is complete, you will have a complete copy of the repository in the server directory. You can then work on the code locally, commit changes, and push them back to the remote repository as needed.

- Create Build directory

```bash
# create a directory with name "build-dir"
mkdir build-dir

# go into "build-dir"
cd build-dir

# Run the following commands in sequence

cmake ../server

# If you want to build with Debugging option
# otherwise just omit  --config Debug
cmake --build . --config Debug
```
Build will take a while to complete and make sure there are no errors while building.

```bash
# go to the directory
cd ..\build-dir\mysql-test

# Test your build
perl mysql-test-run.pl --suite=main --parallel=auto

```

If all the tests came out as passed, we have installed the MariaDB perfectly on Windows machine. 

Thank you for stopping by!