Connect MLAB Mongo instance using mongosqld command


Lot’s of folk are wondering how to connect the MLAB mongo instance using mongosqld so they can connect it via ODBC to Power BI or Tableau. For the full tutorial, you can visit this link

This article only intends to connect the MLAB mongo instance via mongosqld command as usual command will not work with MLAB because mogosqld command tries to connect to admin DB which you don’t have permission to access if you are using mlab. So if you try to connect mlab instance via usual mongosqld query it will throw an error


error initializing schema: error listing databases: error listing databases: (Unauthorized) not authorized on admin to execute command { listDatabases: 1, $db: "admin", $readPreference: { mode: "primary" } }

So in order to connect via mongosqld you need to generate the SCHEMA file beforehand and the define the schema file with mongosqld command so here are the steps:

Step1: Generate the Schema file

mongodrdl  sample --db mydb --out D:\schema.drdl --host "" --port 61644 -u lucian -p pass123 --authenticationDatabase mydb

Step2: Connect via mongosqld

mongosqld --mongo-uri "mongodb://" --schema D:\schema.drdl --auth -u lucian -p pass123 --mongo-authenticationSource mydb --defaultAuthSource mydb -v

Our practice is built around your needs

Let us take the weight of product development off your shoulders and boost your digital presence.