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
- A supported platform - Debian or Ubuntu Linux, or macOS with Homebrew
Step 1: Clone the Repository
Clone the VillageSQL Server repository from GitHub. Clone into your home directory so the CMake steps below work without modification:The repository is several GB due to the MySQL codebase.
Step 2: Install Build Dependencies
Run the setup script from the repository you just cloned. The script detects your operating system and installs the packages the build needs:apt-get and asks for sudo. On macOS it uses
Homebrew. VillageSQL CI installs its build dependencies with the same script,
so the package list stays current with the build.
The script supports Debian or Ubuntu Linux and macOS. On another Linux
distribution, read
villagesql/bld_tools/setup_linux_build_env.sh and
install the equivalent packages with your own package manager.Step 3: Configure with CMake
Create a build directory outside the repository and configure the project:-DWITH_SSL=system so CMake finds the Homebrew OpenSSL:
Paths use
$HOME rather than ~ throughout, on both platforms. The shell only
expands ~ at the start of a word, so --datadir=~/mysql-data/data reaches
mysqld as a directory literally named ~ and the server aborts. Quoting
"$HOME/..." also keeps the path in one piece if your home directory name
contains a space. Replace the repository path with your actual clone location
if different.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 (run from within the build directory):
Step 4: Compile the Code
Build VillageSQL using make with parallel compilation. From within the build directory: Build the server and client (recommended for development):mysql target builds the client used to connect in
Step 7; make -j10 mysqld alone builds
only the server, and Step 7 would then have no client to run.
Build everything:
Step 5: Initialize the Database
Before starting the server for the first time, initialize the data directory: Production (with generated password - recommended):--user=root flag:
Use
--initialize (with password) for production-like setups. Use --initialize-insecure (no password) only for local development and testing. When using --initialize, a temporary password will be generated and printed to the console: A temporary password is generated for root@localhost: <password>Step 6: Start the Server
Start the VillageSQL server:Step 7: Connect with MySQL Client
Open a new terminal and connect to the server using the MySQL client: If using —initialize-insecure (no password):Verify Installation
Check that you’re running VillageSQL:Step 8: 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
Troubleshooting
Build Fails with Missing Dependencies
Run the setup script again. Step 3 leaves you in the build directory, so give the script its absolute path:Server Won’t Start
- Verify the data directory was initialized:
ls "$HOME/mysql-data/data/" - Check if another MySQL/VillageSQL instance is using port 3306
- Review error logs in
$HOME/mysql-data/data/*.err
Extension Installation Fails
- Ensure the extension library (
.soon Linux,.dylibon macOS) exists in the build output - Check that VillageSQL has the necessary permissions to load extensions
- Verify the extension name and .veb filename 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.

