You have three ways to connect to your MemSQL cluster: SingleStore DB Studio, the singlestore
client application, or through any compatible third-party applications.
SingleStore DB Studio
Connect to your cluster by accessing your local SingleStore DB Studio at http://localhost:8080. The default Username is root
and Password is the ROOT PASSWORD
set in step 1 of the Start the Container section of this guide.
SingleStore DB Studio is only supported on Chrome and Firefox browsers at this time.
Hit Enter to log-in.
Once you have successfully logged in, navigate to the SQL Editor page where you can type in SQL commands against your cluster.
SingleStore client application
You can also connect to your cluster through the singlestore
client within the container.
To do this, connect to the container and open the singlestore
client application.
docker exec -it memsql-ciab memsql -p
When prompted, enter your root password (which you defined earlier).
From there, you may run SQL commands against the database at the singlestore>
prompt.
Third-party client application
And because you exposed port 3306 when starting up the MemSQL container, you can also connect with your favorite tools like Sequel Pro, or use tools such as the MySQL client (if you have it installed) to do local development work.
mysql -h 127.0.0.1 -P 3306 -u root --password=${ROOT_PASSWORD} --prompt="singlestore> "
Run Sample Queries
Now that you have connected to your cluster, run the following MemSQL database commands to create a table and seed it with sample data:
CREATE DATABASE test;
USE test;
CREATE TABLE test_table (id BIGINT PRIMARY KEY AUTO_INCREMENT, c INT);
INSERT INTO test_table (c) VALUES (1);
INSERT INTO test_table (c) SELECT c*2 FROM test_table;
INSERT INTO test_table (c) SELECT c*2 FROM test_table;
INSERT INTO test_table (c) SELECT c*2 FROM test_table;
INSERT INTO test_table (c) SELECT c*2 FROM test_table;
INSERT INTO test_table (c) SELECT c*2 FROM test_table;
SELECT SUM(c) FROM test_table;