0% found this document useful (0 votes)
23 views

Buat User

The document shows the configuration and usage of a MySQL database on a Windows system. Several tables are created in a database called toko_alan and some users are granted privileges on those tables. The log demonstrates basic queries and operations like selecting databases, showing tables, inserting data, and granting privileges to users.

Uploaded by

Fahri Pskpt
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
0% found this document useful (0 votes)
23 views

Buat User

The document shows the configuration and usage of a MySQL database on a Windows system. Several tables are created in a database called toko_alan and some users are granted privileges on those tables. The log demonstrates basic queries and operations like selecting databases, showing tables, inserting data, and granting privileges to users.

Uploaded by

Fahri Pskpt
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/ 4

Microsoft Windows [Version 10.0.17763.

1098]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\labkom>cd\

C:\>cd\xampp\mysql\bin

C:\xampp\mysql\bin>mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.1.35-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, 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 |
+--------------------+
| adhiguna |
| information_schema |
| laundry |
| monfari |
| mysql |
| performance_schema |
| perpustakaan |
| phpmyadmin |
| surat |
| susra2 |
| test |
| toko |
| toko_alan |
| tugasku |
| warung |
+--------------------+
15 rows in set (0.00 sec)

MariaDB [(none)]> use toko_alan;


Database changed
MariaDB [toko_alan]> show tables;
Empty set (0.00 sec)

MariaDB [toko_alan]> create table barang


-> (
-> id varchar(5),
-> nama varchar(50),
-> harga int,
-> jumlah
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server versi
on for the right syntax to use near ')' at line 7
MariaDB [toko_alan]> create table barang
-> (
-> id varchar(5),
-> nama varchar(50),
-> harga int,
-> jumlah int
-> );
Query OK, 0 rows affected (0.30 sec)

MariaDB [toko_alan]> create table pegawai


-> (
-> id varchar(5),
-> nama varchar(50),
-> jk varchar(1),
-> jab varchar(15)
-> );
Query OK, 0 rows affected (0.31 sec)

MariaDB [toko_alan]> create table jual


-> (
-> id varchar(5),
-> jumlah int,
-> tgl date
-> );
Query OK, 0 rows affected (0.35 sec)

MariaDB [toko_alan]> show tables;


+---------------------+
| Tables_in_toko_alan |
+---------------------+
| barang |
| jual |
| pegawai |
+---------------------+
3 rows in set (0.00 sec)

MariaDB [toko_alan]> use mysql;


Database changed
MariaDB [mysql]> select user from user;
+-----------+
| user |
+-----------+
| root |
| root |
| |
| KRISTOFEL |
| MONFARI |
| pma |
| root |
| user1 |
| user2 |
| user3 |
+-----------+
10 rows in set (0.00 sec)

MariaDB [mysql]> drop user 'user1'@'localhost';


Query OK, 0 rows affected (0.11 sec)

MariaDB [mysql]> drop user 'user2'@'localhost';


Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> drop user 'user3'@'localhost';


Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> select user from user;


+-----------+
| user |
+-----------+
| root |
| root |
| |
| KRISTOFEL |
| MONFARI |
| pma |
| root |
+-----------+
7 rows in set (0.00 sec)

MariaDB [mysql]> create user 'user1'@'localhost'identified by '1234';


Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> create user 'user2'@'localhost'identified by '1234';


Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> create user 'user3'@'localhost'identified by '1234';


Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> grant all privileges on toko_alan.* to 'user1'@'localhost';


Query OK, 0 rows affected (0.22 sec)

MariaDB [mysql]> grant select,update on toko_alan.barang to 'user2'@'localhost';


Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> grant select,delete on toko_alan.barang to 'user3'@'localhost';


Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> create user 'user11'@'localhost'identified by '1234';


Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> grant select,insert on toko_alan.barang to 'user11'@'localhost';


Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> show grants for 'user1'@'localhost';


+----------------------------------------------------------------------------------
-----------------------
| Grants for user1@localhost
+----------------------------------------------------------------------------------
-----------------------
| GRANT USAGE ON *.* TO 'user1'@'localhost' IDENTIFIED BY PASSWORD
'*A4B6157319038724E3560894F7F932C8886EB
| GRANT ALL PRIVILEGES ON `toko_alan`.* TO 'user1'@'localhost'
+----------------------------------------------------------------------------------
-----------------------
2 rows in set (0.00 sec)

MariaDB [mysql]> quit


Bye

C:\xampp\mysql\bin>mysql -u user11 -p
Enter password: ****
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.1.35-MariaDB mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use toko_alan;
Database changed
MariaDB [toko_alan]> show tables;
+---------------------+
| Tables_in_toko_alan |
+---------------------+
| barang |
+---------------------+
1 row in set (0.00 sec)

MariaDB [toko_alan]> desc barang;


+--------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| id | varchar(5) | YES | | NULL | |
| nama | varchar(50) | YES | | NULL | |
| harga | int(11) | YES | | NULL | |
| jumlah | int(11) | YES | | NULL | |
+--------+-------------+------+-----+---------+-------+
4 rows in set (0.01 sec)

MariaDB [toko_alan]> insert into barang (id,nama,harga,jumlah) values


-> ("B01","BAJU","10000","10"),
-> ("B02","CELANA","10000","10"),
-> ("B03","TOPI","10000","10");
Query OK, 3 rows affected (0.17 sec)
Records: 3 Duplicates: 0 Warnings: 0

MariaDB [toko_alan]> SELECT*FROM BARANG;


+------+--------+-------+--------+
| id | nama | harga | jumlah |
+------+--------+-------+--------+
| B01 | BAJU | 10000 | 10 |
| B02 | CELANA | 10000 | 10 |
| B03 | TOPI | 10000 | 10 |
+------+--------+-------+--------+
3 rows in set (0.00 sec)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy