100% found this document useful (1 vote)
103 views3 pages

Panduan MariaDB untuk Pemula

The document details the steps to create a MySQL database with users and permissions. It involves: 1) Connecting to MySQL as the root user 2) Creating a database called db_12181007 and two tables within it 3) Creating two users and granting permissions to one user for the database and tables
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
103 views3 pages

Panduan MariaDB untuk Pemula

The document details the steps to create a MySQL database with users and permissions. It involves: 1) Connecting to MySQL as the root user 2) Creating a database called db_12181007 and two tables within it 3) Creating two users and granting permissions to one user for the database and tables
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

1. Buka aplikasi Command Prompt pada komputer anda.

(Disarankan untuk membuka


dari tahap awal).

2. Masuklah kedalam MariaDB menggunakan user root.


Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\USER>cd c:\

c:\>"xampp\mysql\bin\mysql.exe" -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
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.

3. Tampilkan daftar database yang ada pada mysql.


MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| db_latihan1 |
| dbakademik |
| information_schema |
| mysql |
| performance_schema |
| phpmyadmin |
| test |
+--------------------+
7 rows in set (0.03 sec)

4. Tampilkan daftar user pada mysql.


MariaDB [(none)]> use mysql;
Database changed
MariaDB [mysql]> select user, host from mysql.user;
+-------+-----------+
| user | host |
+-------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| pma | localhost |
| root | localhost |
| user2 | localhost |
+-------+-----------+
6 rows in set (0.00 sec)

5. Buat user baru pada localhost dengan nama �NIMmasing-masing_coba2� tanpa


password.
MariaDB [mysql]> create user '12181007_coba2'@'localhost';
Query OK, 0 rows affected (0.05 sec)

6. Buat user baru pada localhost dengan nama �NIMmasing-masing_cobalagi� dengan


password �12345�.
MariaDB [mysql]> create user '12181007_cobalagi'@'localhost' identified by '12345';
Query OK, 0 rows affected (0.05 sec)
7. Tampilkan kembali daftar user pada mysql.
MariaDB [mysql]> select user, host from mysql.user;
+-------------------+-----------+
| user | host |
+-------------------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| 12181007_coba2 | localhost |
| 12181007_cobalagi | localhost |
| pma | localhost |
| root | localhost |
| user2 | localhost |
+-------------------+-----------+
8 rows in set (0.00 sec)

8. Masih didalam user root, Buat Database dengan nama �db_NIMmasing-masing�.


MariaDB [mysql]> create database db_12181007;
Query OK, 1 row affected (0.00 sec)

9. Aktifkan database db_NIMmasing-masing_coba, lalu buat dua buah tabel


didalamnya.
MariaDB [mysql]> use db_12181007;
Database changed
MariaDB [db_12181007]> create table buku(kd_buku char(9), judul varchar(40),
penulis varchar(40), penerbit varchar(40), primary key(kd_buku));
Query OK, 0 rows affected (0.38 sec)

MariaDB [db_12181007]> create table katalog(kode char(9), nama varchar(40), primary


key(kode));
Query OK, 0 rows affected (0.27 sec)

10. Tampilkan daftar tabel yang ada pada database db_coba.


MariaDB [db_12181007]> show tables;
+-----------------------+
| Tables_in_db_12181007 |
+-----------------------+
| buku |
| katalog |
+-----------------------+
2 rows in set (0.00 sec)

11. Tampilkan struktur tabel buku dan katalog.


MariaDB [db_12181007]> desc buku;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| kd_buku | char(9) | NO | PRI | NULL | |
| judul | varchar(40) | YES | | NULL | |
| penulis | varchar(40) | YES | | NULL | |
| penerbit | varchar(40) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
4 rows in set (0.03 sec)

MariaDB [db_12181007]> desc katalog;


+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| kode | char(9) | NO | PRI | NULL | |
| nama | varchar(40) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.02 sec)

12. Beri hak akses penuh database db_12181007_coba2 kepada user


�12181007_cobalagi�.
MariaDB [db_12181007]> grant all on db_12181007.buku to
'12181007_cobalagi'@'localhost';
Query OK, 0 rows affected (0.06 sec)

MariaDB [db_12181007]> grant all on db_12181007.katalog to


'12181007_cobalagi'@'localhost';
Query OK, 0 rows affected (0.00 sec)

13. Hapus user �12181007_coba2�, lalu keluar dari root.


MariaDB [db_12181007]> drop user 12181007_coba2@localhost;
Query OK, 0 rows affected (0.05 sec)

MariaDB [db_12181007]> exit;


Bye

14. Masuk kedalam MariaDB menggunakan user �12181007_cobalagi�.


c:\>"xampp\mysql\bin\mysql.exe" -u 12181007_cobalagi -p12345
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6
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.

15. Tampilkan daftar database pada 12181007_cobalagi.


MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| db_12181007 |
| information_schema |
| test |
+--------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]>

You might also like