Skip to content

Connect MindsDB MySQL API to MySQL CLI

MindsDB provides a powerful MySQL API that allows users to connect to it using the MySQL Command-Line Client. Connecting to MySQL API is the same as connecting to a MySQL database:

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

You can either connect locally or to a MindsDB Cloud instance, depending on the case; open your terminal and run:

  mysql -h 127.0.0.1 --port 47335 -u mindsdb
  mysql -h cloud.mindsdb.com --port 3307 -u [mindsdb_cloud_email] -p [mindsdb_cloud_password]

On execution, you should 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
~$ mysql -h cloud.mindsdb.com --port 3306 -u zoran@mindsdb.com -p
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 is next?

We recommend you to follow one of our tutorials or jump more into detail understanding the MindsDB Database