[Data Base] Set up the environment for MySQL in window & basic command

junyong92·2019년 11월 14일

Data base

목록 보기

1. What you need to install?

bitnami amp stack: https://bitnami.com/stack/wamp
vs code: https://code.visualstudio.com
MySQL WorkBench: https://dev.mysql.com/downloads/workbench/

2. Let’s get in to database

Type bellow in command Prompt and fill the password after typing. (You’ve already configured you ID and Password during the installation)

cd C:\Bitnami\wampstack-7.1.26-0\mysql\bin
mysql -uroot -p

You can see bellow if you instaledl MySQL & Bitnami successfully!

3. Create database(Schema) & Show database & USE it

Schema is kind of group of data. It is usually called database in MySQL and Schema in Oracle. As you can see it is little bit confused from whole means of Database. So let’s call it Schema.

SHOW databases;        // show all schema in this database
CREATE DATABASE testdb;// Add the new schema named 'testdb' in database
USE testdb;            // Enther to schema 'testdb'
                       // After using 'USE', what you make, run and update is all for schema 'testdb'

4. Make table

The biggest feature of MySQL is Relational DB and that means it is good to use for data which is fit for using table. Let’s make the table which contains id, title, description, created, author_name and author_profile.

// Create the table 'topic'
 id INT(11),
 title VARCHAR(20),
 description TEXT,
 created DATETIME,
 author_name VARCHAR(20),
 author_profile VARCHAR(100)
// Add the data to the table 'topic'
 (title, id, created, author_name, author_profile)
// Show the data in table 'topic'
SELECT * FROM topic;   // Show all
SELECT id,title,created FROM topic; // Show id, title, created
SELECT * FROM topic WHERE id=1;     // Show the row value of id is 1
SELECT id,title,created FROM topic WHERE id=1;

0개의 댓글