Overview
Building VillageSQL from source gives you the latest features and allows you to customize the build for your specific environment.Prerequisites
Before you begin, ensure you have the following installed:- Git - For cloning the repository
- CMake 3.16 or higher - Build system generator
- C++ Compiler - GCC 8+, Clang 8+, or MSVC 2019+
- Build tools - make, ninja, or equivalent
- Development libraries - OpenSSL, ncurses, pkg-config, bison, and other MySQL dependencies
Install Dependencies
Ubuntu/Debian:Step 1: Clone the Repository
Clone the VillageSQL Server repository from GitHub:The repository is several GB due to the MySQL codebase.
Step 2: Configure with CMake
Create a build directory outside the repository and configure the project:Replace
~/villagesql-server with the actual path to your cloned repository.CMake Options Explained
<path-to-repo>- Path to the cloned VillageSQL repository-DWITH_DEBUG=1- Enables debug symbols (recommended for development)-DCMAKE_INSTALL_PREFIX=$HOME/mysql- Sets installation directory-DWITH_SSL=system- Uses system OpenSSL library (required on macOS)
Additional CMake Options
Production build without debug symbols:If you need to reconfigure, clear the CMake cache first:
Step 3: Compile the Code
Build VillageSQL using make with parallel compilation. From within the build directory: Build only the server (recommended for development):build/bin/ and build/runtime_output_directory/ directories.
Step 4: Initialize the Database
Before starting the server for the first time, initialize the data directory: Production (with generated password - recommended):Use
--initialize (with password) for production-like setups. Use --initialize-insecure (no password) only for local development and testing. Note: Skip password setup if using --initialize-insecure.Step 5: Start the Server
Start the VillageSQL server:Step 6: Connect with MySQL Client
Open a new terminal and connect to the server using the MySQL client: If using —initialize-insecure (no password):Step 7: Set Up Users and Database
Change Root Password
If you used--initialize, change the temporary password:
Create a Development User
For daily development, create a non-root user:Create a Database
Debugging with GDB
For development and troubleshooting, you can run VillageSQL under GDB:Running Tests
VillageSQL includes both unit tests and regression tests to verify functionality.Unit Tests
Run VillageSQL-specific unit tests (from within your build directory):Regression Tests
Change to the mysql-test directory:—suite vs —do-suite:
--suite=villagesqlruns only top-level villagesql tests--do-suite=villagesqlruns all tests including sub-suites (insert, select, stored_procedure, etc.)
Running Individual Tests
Run a specific test by name:Updating Test Results
If you’ve changed functionality and need to update expected test output:Installing Binaries
To install VillageSQL system-wide (requires appropriate permissions):/usr/local/mysql/ by default. You can customize the installation prefix:
Troubleshooting
Build Fails with Missing Dependencies
Install the required development packages for your platform. Check the error message for specific missing libraries.Server Won’t Start
- Verify the data directory was initialized:
ls build/data/ - Check if another MySQL/VillageSQL instance is using port 3306
- Review error logs in
build/data/*.err
Extension Installation Fails
- Ensure the extension library (
.soor.dll) exists in the build output - Check that VillageSQL has the necessary permissions to load extensions
- Verify the extension name and SONAME are correct
Next Steps
Using Extensions
Learn how to install, update, and manage VillageSQL extensions.
Creating Extensions
Build your own custom extensions for VillageSQL.
Getting Started
Quick start guide for VillageSQL.

