A gentle introduction to MindsDB

Ibrahim Zaman
3 min readNov 4, 2023

The reason why you landed on my story is “what is MindsDB” or “maybe what it does” or “might be how to install it on your machine or cloud?”, this article/story introduces you to MindsDB and the questions in your mind. so, without wasting your precious time let’s dive in (:

Ibrahim Zaman aka Mr Tux (@abrahimzaman360)
Image is fetched from MindsDB

What is MindsDB?

MindsDB is an open-source AI solution that helps doing machine learning on top of your database and creating powerful applications, with the SQL like syntax. Just connect plug-in your data (more than 180+ data sources integration available) and do your machine learning work on the data and get the output as never easy before.

Installation:

You can install locally or use MindsDB cloud, but here, I install and use their open-source version which will be self-hosted on our machine through:

  1. Installing through docker:

If you know docker and you have installed it, then move on else you can read another article which is about docker, why docker and its installation.

# pull mindsdb image and run as a container on port 47335 (5GB - download):
# Port 47335 is MySQL container port,
# Port 47335 is mindsdb server and gui port.

# Start with showing logs:
docker run -p 47334:47334 -p 47335:47335 mindsdb/mindsdb

# run headless without showing logs with -d argument:
docker run -d -p 47334:47334 -p 47335:47335 mindsdb/mindsdb

# Note: these above commands will not save your data, if your container
# got deleted or stopped.

# To Persist your data, first create a folder on your machine and
# link it to mindsdb container using:
# Create a folder
mkdir mdb_data

docker run -p 47334:47334 -p 47335:47335 -v $(pwd)/mdb_data:/root/mdb_storage mindsdb/mindsdb
# linked volume to host folder.

after successfully running above instructions, locate this address: http://127.0.0.1:47334/ in your browser and move to next step.

  1. Installing through conda environments:

I use conda in my daily routine, you can also use pipenv as well to create virtual environment.

# Create Conda Virtual Environment using:
conda create -n "your-env-name" python=3.9

# the above command will create conda envirnoment with anyname
# with python version 3.9 which,
# is necessary to install mindsdb else you'll get dependency errors.

# Now, let's activate newly created conda environment using:
conda activate mindsdb

# Now install mindsdb in our environment using:
pip install mindsdb

# it will take some time to download and install dependencies! patience...
# after successful installation run following:
python -m mindsdb

# this will start server and open a tab in browser or
# manually open this address: http://127.0.0.1:47334/

Learning how to MindsDB:

Learning to MindsDB is easy but to cover all features it will take some time, so, you can head over to this link below and learn a lot about it:

What else can we do with MindsDB?

Connect data sources to LLMs using OpenAI API and Chat with your data easily. You can crawl web pages and use LLMs on those etc. There are many use cases, you can work on.

Note:

If you need help regarding MindsDB, you can send me message on my LinkedIn using Link in Bio.

--

--