Вы находитесь на странице: 1из 5

Enter password: ********

Welcome to the MySQL monitor. Commands end with ; or \g.


Your MySQL connection id is 6
Server version: 5.7.20-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its


affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database belajar


-> create database belajar:
-> create database belajar:;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'create
database belajar:
create database belajar:' at line 2
mysql> create database belajar;
Query OK, 1 row affected (0.02 sec)

mysql> grant all on belajar.* to tebe@localhost identified by 'tubagus1';


Query OK, 0 rows affected, 1 warning (0.07 sec)

mysql> show database


-> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'database
show database' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| belajar |
| mysql |
| performance_schema |
| sakila |
| sys |
| world |
+--------------------+
7 rows in set (0.01 sec)

mysql> use belajar


Database changed
mysql> show tables
-> show tables;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'show
tables' at line 2
mysql> use belajar;
Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql> create database belajar2;


Query OK, 1 row affected (0.00 sec)
mysql> use belajar2;
Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql> select now(), user(), version();


+---------------------+----------------+------------+
| now() | user() | version() |
+---------------------+----------------+------------+
| 2018-01-09 13:08:42 | root@localhost | 5.7.20-log |
+---------------------+----------------+------------+
1 row in set (0.05 sec)

mysql> select
-> now(),
-> user(),
-> version();
+---------------------+----------------+------------+
| now() | user() | version() |
+---------------------+----------------+------------+
| 2018-01-09 13:09:31 | root@localhost | 5.7.20-log |
+---------------------+----------------+------------+
1 row in set (0.00 sec)

mysql> select now(), user(), version()\g


+---------------------+----------------+------------+
| now() | user() | version() |
+---------------------+----------------+------------+
| 2018-01-09 13:10:02 | root@localhost | 5.7.20-log |
+---------------------+----------------+------------+
1 row in set (0.00 sec)

mysql> select now(), user(), version()\G


*************************** 1. row ***************************
now(): 2018-01-09 13:10:44
user(): root@localhost
version(): 5.7.20-log
1 row in set (0.00 sec)

mysql> create database belajar;


ERROR 1007 (HY000): Can't create database 'belajar'; database exists
mysql> create database if not exists belajar;
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> show database;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'database' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| belajar |
| belajar2 |
| mysql |
| performance_schema |
| sakila |
| sys |
| world |
+--------------------+
8 rows in set (0.00 sec)

mysql> drop database belajar3


-> ;
ERROR 1008 (HY000): Can't drop database 'belajar3'; database doesn't exist
mysql> drop database if not exists belajar3
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'not
exists belajar3' at line 1
mysql> drop database if exists belajar3;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> create database belajar3;


Query OK, 1 row affected (0.00 sec)

mysql> show databases;


+--------------------+
| Database |
+--------------------+
| information_schema |
| belajar |
| belajar2 |
| belajar3 |
| mysql |
| performance_schema |
| sakila |
| sys |
| world |
+--------------------+
9 rows in set (0.00 sec)

mysql> drop database belajar3;


Query OK, 0 rows affected (0.10 sec)

mysql> show databases;


+--------------------+
| Database |
+--------------------+
| information_schema |
| belajar |
| belajar2 |
| mysql |
| performance_schema |
| sakila |
| sys |
| world |
+--------------------+
8 rows in set (0.00 sec)

mysql> use belajar2;


Database changed
mysql> create table user_helpdesk (nim char(9), nama char(50), umur int,
tempat_lahir char(50), jurusan char(30);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at
line 1
mysql> create table user_helpdesk (nim char(9), nama char(50), umur int,
tempat_lahir char(50), jurusan char(30));
Query OK, 0 rows affected (0.57 sec)

mysql> show tables;


+--------------------+
| Tables_in_belajar2 |
+--------------------+
| user_helpdesk |
+--------------------+
1 row in set (0.00 sec)

mysql> describe user_helpdesk


-> ;
+--------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+----------+------+-----+---------+-------+
| nim | char(9) | YES | | NULL | |
| nama | char(50) | YES | | NULL | |
| umur | int(11) | YES | | NULL | |
| tempat_lahir | char(50) | YES | | NULL | |
| jurusan | char(30) | YES | | NULL | |
+--------------+----------+------+-----+---------+-------+
5 rows in set (0.05 sec)

mysql> LOAD DATA LOCAL INFILE 'D:/user_helpdesk.csv' into table user_helpdesk2


fields terminated by ';' enclosed by'"' lines terminated by'\n';
Query OK, 6 rows affected, 6 warnings (0.02 sec)
Records: 6 Deleted: 0 Skipped: 0 Warnings: 6

mysql> select * from user_helpdesk2;


+-----------+-----------------+------+--------------+----------------+
| nim | nama | umur | tempat_lahir | jurusan |
+-----------+-----------------+------+--------------+----------------+
| 101401030 | Alex Ferdinand | 21 | Padang | Ilmu Komputer |
| 120502045 | Joko Suprianto | 19 | Jakarta | Manajemen |
| 110901033 | Susi Sulastri2 | 20 | Medan | Kedokteran |
| 100301021 | Suparman | 21 | Jakarta | Teknik Elektro |
| 121401074 | Tania Mutia | 19 | Padang | Ilmu Komputer |
| 110501023 | Aprilia Susanti | 20 | Pekanbaru | Manajemen |
+-----------+-----------------+------+--------------+----------------+
6 rows in set (0.00 sec)

mysql> create table semua (No int,Hari char(50),Shift char(50),Tanggal


date,Eskalasi char(50),No_form_Service char(50), Penerima_Aduan char(50), Subjek
char(50), Institusi char(50), Institusi_Tujuan char(50), Kategori_Institusi
char(50), Tag char(50), Kategori_Produk char(50), Kategori_Feedback char(50),
Sub_Kategori char(50), Media char(50), Status_lvl_1 char(50), Tgl_Close date,Durasi
time, Umur_Kasus int, PIC char(50), No_Form_lvl2 char(50),Tipe_Form char(50),
Output char(50), Sumber_Data char(50), Status char(50));
Query OK, 0 rows affected (0.37 sec)

mysql> show tables;


+--------------------+
| Tables_in_belajar2 |
+--------------------+
| semua |
| user_helpdesk |
| user_helpdesk2 |
+--------------------+
3 rows in set (0.00 sec)

mysql> describe semua;


+--------------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+----------+------+-----+---------+-------+
| No | int(11) | YES | | NULL | |
| Hari | char(50) | YES | | NULL | |
| Shift | char(50) | YES | | NULL | |
| Tanggal | date | YES | | NULL | |
| Eskalasi | char(50) | YES | | NULL | |
| No_form_Service | char(50) | YES | | NULL | |
| Penerima_Aduan | char(50) | YES | | NULL | |
| Subjek | char(50) | YES | | NULL | |
| Institusi | char(50) | YES | | NULL | |
| Institusi_Tujuan | char(50) | YES | | NULL | |
| Kategori_Institusi | char(50) | YES | | NULL | |
| Tag | char(50) | YES | | NULL | |
| Kategori_Produk | char(50) | YES | | NULL | |
| Kategori_Feedback | char(50) | YES | | NULL | |
| Sub_Kategori | char(50) | YES | | NULL | |
| Media | char(50) | YES | | NULL | |
| Status_lvl_1 | char(50) | YES | | NULL | |
| Tgl_Close | date | YES | | NULL | |
| Durasi | time | YES | | NULL | |
| Umur_Kasus | int(11) | YES | | NULL | |
| PIC | char(50) | YES | | NULL | |
| No_Form_lvl2 | char(50) | YES | | NULL | |
| Tipe_Form | char(50) | YES | | NULL | |
| Output | char(50) | YES | | NULL | |
| Sumber_Data | char(50) | YES | | NULL | |
| Status | char(50) | YES | | NULL | |
+--------------------+----------+------+-----+---------+-------+
26 rows in set (0.00 sec)