Dolt
Dolt – Git for Data
Install / Use
/learn @dolthub/DoltREADME
Dolt is Git for Data!
Dolt is a SQL database that you can fork, clone, branch, merge, push and pull just like a Git repository.
Connect to Dolt just like any MySQL database to read or modify schema and data. Version control functionality is exposed in SQL via system tables, functions, and procedures.
Or, use the Git-like command line interface to import CSV files, commit your changes, push them to a remote, or merge your teammate's changes. All the commands you know for Git work exactly the same for Dolt.
Git versions files. Dolt versions tables. It's like Git and MySQL had a baby.
We also built DoltHub, a place to share Dolt databases. We host public data for free. If you want to host your own version of DoltHub, we have DoltLab. If you want us to run a Dolt server for you, we have Hosted Dolt.
Prefer Postgres instead of MySQL? Try Doltgres, now in its Beta release.
Join us on Discord to say hi and ask questions, or check out our roadmap to see what we're building next.
Video Introduction
What's it for?
Lots of things! Dolt is a generally useful tool with countless applications. But if you want some ideas, here's how people are using it so far.
Dolt can be set up as a replica of your existing MySQL database using standard MySQL binlog replication. Every write becomes a Dolt commit. This is a great way to get the version control benefits of Dolt and keep an existing MySQL database.
Dolt CLI
The dolt CLI has the same commands as git, with some extras.
$ dolt
Valid commands for dolt are
init - Create an empty Dolt data repository.
status - Show the working tree status.
add - Add table changes to the list of staged table changes.
diff - Diff a table.
reset - Remove table changes from the list of staged table changes.
clean - Remove untracked tables from working set.
commit - Record changes to the repository.
sql - Run a SQL query against tables in repository.
sql-server - Start a MySQL-compatible server.
log - Show commit logs.
branch - Create, list, edit, delete branches.
checkout - Checkout a branch or overwrite a table from HEAD.
merge - Merge a branch.
conflicts - Commands for viewing and resolving merge conflicts.
cherry-pick - Apply the changes introduced by an existing commit.
revert - Undo the changes introduced in a commit.
clone - Clone from a remote data repository.
fetch - Update the database from a remote data repository.
pull - Fetch from a dolt remote data repository and merge.
push - Push to a dolt remote.
config - Dolt configuration.
remote - Manage set of tracked repositories.
backup - Manage a set of server backups.
login - Login to a dolt remote host.
creds - Commands for managing credentials.
ls - List tables in the working set.
schema - Commands for showing and importing table schemas.
table - Commands for copying, renaming, deleting, and exporting tables.
tag - Create, list, delete tags.
blame - Show what revision and author last modified each row of a table.
constraints - Commands for handling constraints.
migrate - Executes a database migration to use the latest Dolt data format.
read-tables - Fetch table(s) at a specific commit into a new dolt repo
gc - Cleans up unreferenced data from the repository.
filter-branch - Edits the commit history using the provided query.
merge-base - Find the common ancestor of two commits.
version - Displays the current Dolt cli version.
dump - Export all tables in the working set into a file.
Installation
Dolt is a single ~103 megabyte program.
dolt $ du -h /Users/timsehn/go/bin/dolt
103M /Users/timsehn/go/bin/dolt
It's really easy to install. Download it and put it on your PATH.
We have a bunch of ways to make this even easier for most platforms.
From Latest Release
To install on Linux or Mac based systems run this command in your terminal:
sudo bash -c 'curl -L https://github.com/dolthub/dolt/releases/latest/download/install.sh | bash'
This will download the latest dolt release and put it in
/usr/local/bin/, which is probably on your $PATH.
The install script needs sudo in order to put dolt in /usr/local/bin. If you don't have root
privileges or aren't comfortable running a script with them, you can download the dolt binary
for your platform from the latest release, unzip it,
and put the binary somewhere on your $PATH.
Linux
Arch Linux
Dolt is packaged in the official repositories for Arch Linux.
pacman -S dolt
Mac
Homebrew
Dolt is on Homebrew, updated every release.
brew install dolt
MacPorts
On macOS, Dolt can also be installed via a community-managed port via MacPorts:
sudo port install dolt
Windows
Download the latest Microsoft Installer (.msi file) in
releases and run
it.
For information on running on Windows, see here.
Chocolatey
You can install dolt using Chocolatey:
choco install dolt
Docker
There are following official Docker images for Dolt:
dolthub/doltfor running Dolt as CLI tool.dolthub/dolt-sql-serverfor running Dolt in server mode.
From Source
Make sure you have Go installed, and that go is in your path. Dolt has a dependency on cgo, so you will need a working C compiler and toolchain as well.
Clone this repository and cd into the go directory. Then run:
go install ./cmd/dolt
The output will be in $GOPATH/bin, which defaults to ~/go/bin. To test your build, try:
~/go/bin/dolt version
Configuration
Verify that your installation has succeeded by running dolt in your
terminal.
$ dolt
Valid commands for dolt are
[...]
Configure dolt with your user name and email, which you'll need to
create commits. The commands work exactly the same as git.
$ dolt config --global --add user.email YOU@DOMAIN.COM
$ dolt config --global --add user.name "YOUR NAME"
Getting started
Navigate to the directory where you would like your data stored
Dolt needs a place to store your databases. I'm going to put my databases in ~/dolt.
% cd ~
% mkdir dolt
% cd dolt
Any databases you create will be stored in this directory. So, for this example, a directory named getting_started will be created here once you run create database getting_started. Navigating to ~/dolt/getting_started will allow you to access this database using the Dolt command line.
NOTE: For this example, the getting_started directory will be created after you run create database getting_started; in a SQL shell in the Create a schema section. Don't do anything except make the directory and navigate to it just yet.
Start a MySQL-compatible database server
Dolt ships with a MySQL compatible database server built in. To start it you use the command dolt sql-server. Running this command starts the server on port 3306.
dolt sql-server
Starting server with Config HP="localhost:3306"|T="28800000"|R="false"|L="info"
Your terminal will just hang there. This means the server is running. Any errors will be printed in this terminal. Just leave it there and open a new terminal.
Connect with a MySQL client (up to version 8.4)
In the new terminal, we will now connect to the running database server using a client. Dolt also ships with a MySQL compatible client.
% dolt -u root -p "" sql
# Welcome to the Dolt MySQL client.
# Statements must be terminated with ';'.
# "exit" or "quit" (or Ctrl-D) to exit.
mysql>
In the other terminal where you ran dolt sql-server, you'll see the following log line.
2022-06-06T13:14:32-07:00 INFO [conn 1] NewConnection {DisableClientMultiStatements=false}
You are connected!
While we're here let's grab a copy of MySQL so we can connect with that client. Head over to the MySQL Getting Started documentation and install MySQL on your machine. I used Homebrew to install MySQL on my Mac: brew install mysql@8.4. Alternatively, you can install only the client component by running brew install mysql-client@8.4.
NOTE: Make sure you install a MySQL 8.4 release. MySQL 8.4 is the current Long Term Support (LTS) release, meaning this is the stable and supported version of MySQL. MySQL 9.0 is also available, but is an "innovation" release, meaning it has more recent changes and features, but may not be as stable as the LTS release. The 9.0 release changes authentication support and isn't able to connect to a Dolt SQL server by default. You can install MySQL 8.4 with Homebrew

