Sei sulla pagina 1di 3

NAMA : Selamet

NIM : 12182235
KELAS : 12.2C.02
PELAJARAN : APLIKASI BASIS DATA

c:\>"xampp/mysql/bin/mysql.exe" -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.30-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> show databases;


+--------------------+
| Database |
+--------------------+
| db_lat1 |
| information_schema |
| mysql |
| performance_schema |
| phpmyadmin |
| test |
+--------------------+
6 rows in set (0.05 sec)

MariaDB [(none)]> select user, host from mysql.user;


+------+-----------+
| user | host |
+------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| pma | localhost |
| root | localhost |
+------+-----------+
5 rows in set (0.06 sec)

MariaDB [(none)]> create user 'user_coba2'@'localhost' identified by '12345';


Query OK, 0 rows affected (0.10 sec)

MariaDB [(none)]> create user 'user_cobalagi'@'localhost';


Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> select user, host from mysql.user;


+---------------+-----------+
| user | host |
+---------------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| pma | localhost |
| root | localhost |
| user_coba2 | localhost |
| user_cobalagi | localhost |
+---------------+-----------+
7 rows in set (0.00 sec)
MariaDB [(none)]> create database db_coba;
Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> use db_coba;


Database changed
MariaDB [db_coba]> create table buku (kd_buku char(5), judul varchar(40), penulis
varchar(35), penerbit varchar(35));
Query OK, 0 rows affected (0.58 sec)

MariaDB [db_coba]> create table katalog (kode char(5), nama varchar(30));


Query OK, 0 rows affected (0.19 sec)

MariaDB [db_coba]> show tables;


+-------------------+
| Tables_in_db_coba |
+-------------------+
| buku |
| katalog |
+-------------------+
2 rows in set (0.02 sec)

MariaDB [db_coba]> desc buku;


+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| kd_buku | char(5) | YES | | NULL | |
| judul | varchar(40) | YES | | NULL | |
| penulis | varchar(35) | YES | | NULL | |
| penerbit | varchar(35) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
4 rows in set (0.05 sec)

MariaDB [db_coba]> desc katalog;


+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| kode | char(5) | YES | | NULL | |
| nama | varchar(30) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

MariaDB [db_coba]> grant all on db_coba to 'user_coba2'@'localhost';


Query OK, 0 rows affected (0.05 sec)

MariaDB [db_coba]> drop user user_cobalagi@localhost;


Query OK, 0 rows affected (0.04 sec)

MariaDB [db_coba]> exit;


Bye

c:\>"xampp/mysql/bin/mysql.exe" -u user_coba2 -p12345


Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.30-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.


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

MariaDB [(none)]> show databases;


+--------------------+
| Database |
+--------------------+
| db_coba |
| information_schema |
| test |
+--------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]>

Potrebbero piacerti anche