Search code examples
sqldatabasemetabase

How to create a database from a .sql file in Metabase


I have to work with someone who can't install mySqlWorkbench in is professional computer, but he has Metabase installed ; is it possible in Metabase to create - as in mySqlWorkBench - a database from a .sql file ? Let say for instance, how can I execute the following code in Metabase to create a (new) database directly :

DROP DATABASE IF EXISTS `sql_invoicing`;
CREATE DATABASE `sql_invoicing`; 
USE `sql_invoicing`;

SET NAMES utf8 ;
SET character_set_client = utf8mb4 ;

CREATE TABLE `payment_methods` (
  `payment_method_id` tinyint(4) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  PRIMARY KEY (`payment_method_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
INSERT INTO `payment_methods` VALUES (1,'Credit Card');
INSERT INTO `payment_methods` VALUES (2,'Cash');
INSERT INTO `payment_methods` VALUES (3,'PayPal');
INSERT INTO `payment_methods` VALUES (4,'Wire Transfer');

Solution

  • Metabase is not a storage engine. It connects to the existing database, as described here, so your coworker should set up a MySQL DB on his own machine.