Skip to content

MindsDB and MySQL CLI

MindsDB provides a powerful MySQL API that allows users to connect to it using the MySQL Command Line Client. Please note that connecting to MindsDB's MySQL API is the same as connecting to a MySQL database.

How to Connect

To connect to MindsDB, run the below command in your MySQL CLI and provide the connection details, such as host, port, username, and password.

mysql -h [hostname] --port [TCP/IP port number] -u [user] -p [password]

Here are the commands that allow you to connect to either a local MindsDB installation or a MindsDB Cloud instance.

mysql -h 127.0.0.1 --port 47335 -u mindsdb
mysql -h cloud.mindsdb.com --port 3306 -u [mindsdb_cloud_username] -p [mindsdb_cloud_password]

On execution, we get:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Server version: 5.7.1-MindsDB-1.0 (MindsDB)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]>

Example

In this example, we connect to the MindsDB Cloud instance, as below.

mysql -h cloud.mindsdb.com --port 3306 -u zoran@mindsdb.com -p

On execution, we get:

Enter password:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Server version: 5.7.1-MindsDB-1.0 (MindsDB)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]>

What's Next?

Now that you are all set, we recommend you check out our Tutorials and Community Tutorials sections, where you'll find various examples of regression, classification, and time series predictions with MindsDB.

To learn more about MindsDB itself, follow the guide on MindsDB database structure. Also, don't miss out on the remaining pages from the SQL API section, as they explain a common SQL syntax with examples.

Have fun!