Giter Site home page Giter Site logo

d-mariadb's Introduction

D-MariaDB

啟用Mariadb說明書

先下載dockerfile

git clone https://github.com/SUN-PEI-YUAN/D-MariaDB.git

由於airlines.csv檔案過大,所以請至下載資料並放入D-MariaDB資料夾中

進入資料夾後

docker build -t webserver-mariadb .

接下來啟用MariaDB與phpmyadmin以管理資料庫

docker-compose -f docker-compose.yml up 

確認一下container是否成功建立

成功後,進入0.0.0.0:8080,並在 rbase 中建立 airlines table

use rbase;
create table airlines (
  Year int,
  Month int,
  DayofMonth int,
  DayOfWeek int,
  DepTime  int,
  CRSDepTime int,
  ArrTime int,
  CRSArrTime int,
  UniqueCarrier varchar(5),
  FlightNum int,
  TailNum varchar(8),
  ActualElapsedTime int,
  CRSElapsedTime int,
  AirTime int,
  ArrDelay int,
  DepDelay int,
  Origin varchar(3),
  Dest varchar(3),
  Distance int,
  TaxiIn int,
  TaxiOut int,
  Cancelled int,
  CancellationCode varchar(1),
  Diverted varchar(1),
  CarrierDelay int,
  WeatherDelay int,
  NASDelay int,
  SecurityDelay int,
  LateAircraftDelay int
);

進入MariaDB中將csv匯入資料庫

sudo docker exec -it tku-mariadb bash
mysql -uroot -p123456
LOAD DATA LOCAL INFILE '/tmp/airlines.csv' 
INTO TABLE airlines
FIELDS TERMINATED BY ','
ENCLOSED BY '\"' 
LINES TERMINATED BY '\n' 
IGNORE 1 LINES
(
  Year, 
  Month, 
  DayofMonth, 
  DayOfWeek, 
  DepTime, 
  CRSDepTime, 
  ArrTime, 
  CRSArrTime, 
  UniqueCarrier, 
  FlightNum, 
  TailNum, 
  ActualElapsedTime, 
  CRSElapsedTime, 
  AirTime, 
  ArrDelay, 
  DepDelay, 
  Origin, 
  Dest, 
  Distance, 
  TaxiIn, 
  TaxiOut, 
  Cancelled, 
  CancellationCode, 
  Diverted, 
  CarrierDelay, 
  WeatherDelay, 
  NASDelay, 
  SecurityDelay, 
  LateAircraftDelay
);

d-mariadb's People

Contributors

mark10609 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.