Running the Server
There are two ways to run SQL queries against your database:
  • dolt sql-server starts a MySQL-compatible server
  • dolt sql runs SQL queries from your shell without starting a server

dolt sql-server

The dolt sql-server command runs a MySQL compatible server which clients can connect to and execute queries against. Any library or tool that can connect to MySQL can connect to Dolt.
1
% dolt sql-server
2
Starting server with Config HP="localhost:3306"|U="root"|P=""|T="28800000"|R="false"|L="info"
Copied!
The host, user, password, timeout, logging info and other options can be set on the command line or via a config file.
View the dolt sql-server command documentation here.

dolt sql

Using dolt sql you can issue SQL statements against a local database without starting a server.
With no arguments, dolt sql begins an interactive shell.
1
% dolt sql
2
# Welcome to the DoltSQL shell.
3
# Statements must be terminated with ';'.
4
# "exit" or "quit" (or Ctrl-D) to exit.
5
menus> show tables;
6
+------------+
7
| Table |
8
+------------+
9
| menu_items |
10
+------------+
11
menus> exit
12
Bye
Copied!
With the -q flag, it executes queries specified as arguments.
1
% dolt sql -q "show tables"
2
+------------+
3
| Table |
4
+------------+
5
| menu_items |
6
+------------+
Copied!
You can also use STDIN to the dolt sql command to execute many SQL statements at once. This is useful for importing a dump from another database.
1
% dolt sql < mysqldump.sql
Copied!
View the dolt sql command documentation here.
Export as PDF
Copy link
Edit on GitHub