laika222
4/17/2017 - 7:21 PM

How to create a database and import it from a .sql file. 1) import the .sql file to the workspace, 2) right click and Copy File Path of the

How to create a database and import it from a .sql file. 1) import the .sql file to the workspace, 2) right click and Copy File Path of the .sql file from the browser, 3) start mysql and start command command line, 4) CREATE DATABASE database_name, 5) USE database_name to use it in the cli, 6), use SOURCE to tell it where to import the tables from.

mysql-ctl start;

mysql-ctl cli;

CREATE DATABASE baseball;

USE baseball;

SOURCE ~/workspace/Baseball/BDB-sql-2011-03-28.sql


-- DETAIL!!!

-- Starts mySQL
mysql-ctl start;

-- Enters command line interface
mysql-ctl cli;

-- CREATEs DATABASE baseball
CREATE DATABASE baseball;

-- USEs databases baseball (selects it so you can work on it)

USE baseball;

-- Imports from the SOURCE .sql file

SOURCE ~/workspace/Baseball/BDB-sql-2011-03-28.sql