LogoLogo
DoltHubBlogDiscordGitHubDolt
  • Introduction
    • What Is Dolt?
    • Installation
      • Linux
      • Windows
      • Mac
      • Build from Source
      • Application Server
      • Docker
      • Upgrading
    • Getting Started
      • Version Controlled Database
      • Git For Data
      • Versioned MySQL Replica
    • Use Cases
      • Data Sharing
      • Data and Model Quality Control
      • Manual Data Curation
      • Version Control for your Application
      • Versioned MySQL Replica
      • Audit
      • Configuration Management
      • Offline First
  • Concepts
    • Dolt
      • Git
        • Commits
        • Log
        • Diff
        • Branch
        • Merge
        • Conflicts
        • Remotes
        • Working Set
      • SQL
        • Databases
        • Schema
        • Tables
        • Primary Keys
        • Types
        • Indexes
        • Views
        • Constraints
        • Triggers
        • Procedures
        • Users/Grants
        • Transactions
        • System Variables
      • RDBMS
        • Server
        • Backups
        • Replication
    • DoltHub/DoltLab
      • Permissions
      • Pull Requests
      • Issues
      • Forks
  • SQL Reference
    • Running the Server
      • Configuration
      • Access Management
      • Branch Permissions
      • Backups
      • Garbage Collection
      • Metrics
      • Replication
      • Troubleshooting
    • Version Control Features
      • Using Branches
      • Merges
      • Querying History
      • Using Remotes
      • Procedures
      • Functions
      • System Tables
      • System Variables
      • Saved Queries
    • SQL Language Support
      • Data Description
      • Expressions, Functions, Operators
      • Supported Statements
      • MySQL Information Schema
      • Collations and Character Sets
      • System Variables
      • Miscellaneous
    • Supported Clients
      • Programmatic
      • SQL Editors
    • Benchmarks and Metrics
      • Correctness
      • Latency
      • Import
  • CLI Reference
    • Commands
    • Git Comparison
  • Architecture
    • Overview
    • Storage Engine
      • Commit Graph
      • Prolly Trees
      • Block Store
    • SQL
      • Go MySQL Server
      • Vitess
  • Guides
    • Cheat Sheet
    • Contributing
      • dolt
      • go-mysql-server
    • MySQL to Dolt Replication
    • Importing Data
    • Integrations
  • Other
    • FAQ
    • Roadmap
    • Versioning
  • Products
    • Hosted Dolt
      • Getting Started
      • Notable Features
      • SQL Workbench
      • Cloning a Hosted Database
      • Using DoltHub as a Remote
      • Infrastructure
    • DoltHub
      • Data Sharing
      • API
        • Authentication
        • SQL
        • CSV
        • Database
        • Hooks
      • Continuous Integration
        • Getting Started
        • Workflow Reference
      • Transform File Uploads
      • Workspaces
    • DoltLab
    • Dolt Workbench
    • DoltgreSQL
Powered by GitBook
On this page
  • dolt sql-server
  • Stopping the server
  • dolt sql

Was this helpful?

Edit on GitHub
Export as PDF
  1. SQL Reference

Running the Server

PreviousForksNextConfiguration

Last updated 1 year ago

Was this helpful?

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.

% dolt sql-server
Starting server with Config HP="localhost:3306"|U="root"|P=""|T="28800000"|R="false"|L="info"

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 .

Stopping the server

The dolt sql-server process can be stopped using your operating system's process control mechanism. Dolt will stop when sent a signal like SIGHUP, SIGQUIT, SIGABRT, or SIGKILL.

A common way to send a SIGKILL is to navigate to the shell running the dolt sql-server process and Ctrl-C.

Another common way to stop the server is to identify the process running dolt sql-server and send a signal to it using the kill command.

$ ps -a | grep dolt
66187 ttys000    0:00.00 grep dolt
46800 ttys003  3351:00.34 dolt sql-server
65544 ttys010    0:07.82 dolt push
$ kill -QUIT 46800

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.

% dolt sql
# Welcome to the DoltSQL shell.
# Statements must be terminated with ';'.
# "exit" or "quit" (or Ctrl-D) to exit.
menus> show tables;
+------------+
| Table      |
+------------+
| menu_items |
+------------+
menus> exit
Bye

With the -q flag, it executes queries specified as arguments.

% dolt sql -q "show tables"
+------------+
| Table      |
+------------+
| menu_items |
+------------+
% dolt sql < mysqldump.sql

You can also use STDIN to the dolt sql command to execute many SQL statements at once. This is useful for .

View the dolt sql command documentation .

importing a dump from another database
here
here