Anda di halaman 1dari 11

mysql> select host,user,password from user;

+-----------+------+----------+
| host | user | password |
+-----------+------+----------+
| localhost | root | |
| 127.0.0.1 | root | |
| localhost | | |
| localhost | pma | |
+-----------+------+----------+
4 rows in set (0.00 sec)
mysql> select host,user,password from user;
+-----------+------+----------+
| host | user | password |
+-----------+------+----------+
| localhost | root | |
| 127.0.0.1 | root | |
| localhost | | |
| localhost | pma | |
+-----------+------+----------+
4 rows in set (0.00 sec)
mysql> grant insert,select,create,delete,update
-> on *.*
-> to 'careem'@'localhost'
-> indentified by 'careem06';
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 'inden
tified by 'careem06'' at line 4
mysql> grant insert,select,create,delete,update on *.*
-> to 'careem' @ 'localhost'
-> identified by 'careem06';
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 ''loca
lhost'
identified by 'careem06'' at line 2
mysql> grant insert,create,select on *.*
-> to 'careem'@'localhost'
-> identified by 'careem06';
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
C:\xampp\mysql\bin>mysql -u root -p careem06;
Enter password: ********
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y
ES)
C:\xampp\mysql\bin>mysql -u root -p careem;
Enter password: ********
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y
ES)
C:\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 68
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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> select host,user,password from user;
ERROR 1046 (3D000): No database selected
mysql> use user;
ERROR 1049 (42000): Unknown database 'user'
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 'datab
ase' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cdcol |
| mysql |
| performance_schema |
| phpmyadmin |
| test |
| webauth |
+--------------------+
7 rows in set (0.05 sec)
mysql> use user;
ERROR 1049 (42000): Unknown database 'user'
mysql> flush previleges;
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 'previ
leges' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cdcol |
| mysql |
| performance_schema |
| phpmyadmin |
| test |
| webauth |
+--------------------+
7 rows in set (0.00 sec)
mysql> \q
Bye
C:\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 69
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cdcol |
| mysql |
| performance_schema |
| phpmyadmin |
| test |
| webauth |
+--------------------+
7 rows in set (0.00 sec)
mysql> grant insert,create,select on *.*
-> to 'careem'@'localhost'
-> identified by 'careem06';
Query OK, 0 rows affected (0.02 sec)
mysql> select host,user,password from user;
ERROR 1046 (3D000): No database selected
mysql> flush previleges;
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 'previ
leges' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cdcol |
| mysql |
| performance_schema |
| phpmyadmin |
| test |
| webauth |
+--------------------+
7 rows in set (0.00 sec)
mysql> use mysql
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
24 rows in set (0.23 sec)
mysql> select host,user,password from user;
+-----------+--------+-------------------------------------------+
| host | user | password |
+-----------+--------+-------------------------------------------+
| localhost | root | |
| 127.0.0.1 | root | |
| localhost | | |
| localhost | pma | |
| localhost | careem | *A1612E8F81B1D7D605E4D6074302E67B7A5531D0 |
+-----------+--------+-------------------------------------------+
5 rows in set (0.00 sec)
mysql> flush previleges;
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 'previ
leges' at line 1
mysql> \q
Bye
C:\xampp\mysql\bin>msql -u root -p careem
'msql' is not recognized as an internal or external command,
operable program or batch file.
C:\xampp\mysql\bin>msql -u root -pcareem
'msql' is not recognized as an internal or external command,
operable program or batch file.
C:\xampp\mysql\bin>msql -u careem -p
'msql' is not recognized as an internal or external command,
operable program or batch file.
C:\xampp\mysql\bin>mysql -u careem -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 70
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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 latihan;
Query OK, 1 row affected (0.00 sec)
mysql> use latihan;
Database changed
mysql> create table coba (nama varchar(10), alamat varchar(25));
Query OK, 0 rows affected (0.19 sec)
mysql> show tables;
+-------------------+
| Tables_in_latihan |
+-------------------+
| coba |
+-------------------+
1 row in set (0.02 sec)
mysql> desc coba;
+--------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| nama | varchar(10) | YES | | NULL | |
| alamat | varchar(25) | YES | | NULL | |
+--------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> insert into coba('mahmud','jl palagan' );
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 ''mahm
ud','jl palagan' )' at line 1
mysql> insert into coba values('mahmud','jl palagan' );
Query OK, 1 row affected (0.09 sec)
mysql> select * from coba;
+--------+------------+
| nama | alamat |
+--------+------------+
| mahmud | jl palagan |
+--------+------------+
1 row in set (0.05 sec)
mysql> insert into coba values ('dani','jl godean'),('rani','jl kaliurang'),('ma
rkonah','jl wates'),('paijo','jl bantul');
Query OK, 4 rows affected (0.08 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> select * from coba;
+----------+--------------+
| nama | alamat |
+----------+--------------+
| mahmud | jl palagan |
| dani | jl godean |
| rani | jl kaliurang |
| markonah | jl wates |
| paijo | jl bantul |
+----------+--------------+
5 rows in set (0.00 sec)
mysql>
mysql> select * from coba;
+----------+--------------+
| nama | alamat |
+----------+--------------+
| mahmud | jl palagan |
| dani | jl godean |
| rani | jl kaliurang |
| markonah | jl wates |
| paijo | jl bantul |
+----------+--------------+
5 rows in set (0.00 sec)
mysql> grant insert,select,create,delete
-> on *.*
-> to 'paijo'@'localhost'
-> identified by 'paijo';
ERROR 1045 (28000): Access denied for user 'careem'@'localhost' (using password:
YES)
mysql> delet from coba where nama='paijo';
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 'delet
from coba where nama='paijo'' at line 1
mysql> delet from coba where nama 'paijo';
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 'delet
from coba where nama 'paijo'' at line 1
mysql> delete from coba where nama='paijo';
ERROR 1142 (42000): DELETE command denied to user 'careem'@'localhost' for table
'coba'
mysql>
mysql> select user,host,password from user;
+--------+-----------+-------------------------------------------+
| user | host | password |
+--------+-----------+-------------------------------------------+
| root | localhost | |
| root | 127.0.0.1 | |
| | localhost | |
| pma | localhost | |
| careem | localhost | *A1612E8F81B1D7D605E4D6074302E67B7A5531D0 |
+--------+-----------+-------------------------------------------+
5 rows in set (0.00 sec)
mysql> grant delete,update
-> on *.*
-> to 'careem'@'localhost';
ERROR 1045 (28000): Access denied for user 'careem'@'localhost' (using password:
YES)
mysql>
mysql> select user,host,password from user;
+--------+-----------+-------------------------------------------+
| user | host | password |
+--------+-----------+-------------------------------------------+
| root | localhost | |
| root | 127.0.0.1 | |
| | localhost | |
| pma | localhost | |
| careem | localhost | *A1612E8F81B1D7D605E4D6074302E67B7A5531D0 |
+--------+-----------+-------------------------------------------+
5 rows in set (0.00 sec)
mysql> grant delete,update
-> on *.*
-> to 'careem'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> use latihan;
Database changed
mysql> select * from coba;
+----------+--------------+
| nama | alamat |
+----------+--------------+
| mahmud | jl palagan |
| dani | jl godean |
| rani | jl kaliurang |
| markonah | jl wates |
| paijo | jl bantul |
+----------+--------------+
5 rows in set (0.00 sec)
mysql> delete from coba where nama='paijo';
Query OK, 1 row affected (0.09 sec)
mysql> select * from coba;
+----------+--------------+
| nama | alamat |
+----------+--------------+
| mahmud | jl palagan |
| dani | jl godean |
| rani | jl kaliurang |
| markonah | jl wates |
+----------+--------------+
4 rows in set (0.00 sec)
mysql>
mysql> select host,insert_priv,delete_priv,update_priv,alter_priv
-> from user;
ERROR 1146 (42S02): Table 'latihan.user' doesn't exist
mysql> use mysql
Database changed
mysql> select host,insert_priv,delete_priv,update_priv,alter_priv
-> from user;
+-----------+-------------+-------------+-------------+------------+
| host | insert_priv | delete_priv | update_priv | alter_priv |
+-----------+-------------+-------------+-------------+------------+
| localhost | Y | Y | Y | Y |
| 127.0.0.1 | Y | Y | Y | Y |
| localhost | N | N | N | N |
| localhost | N | N | N | N |
| localhost | Y | Y | Y | N |
+-----------+-------------+-------------+-------------+------------+
5 rows in set (0.00 sec)
mysql>
C:\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 75
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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> select host,user,delete_priv,update_priv,alter_priv,insert_priv
-> from user;
ERROR 1046 (3D000): No database selected
mysql> use mysql;
Database changed
mysql> select host,user,delete_priv,update_priv,alter_priv,insert_priv
-> from user;
+-----------+--------+-------------+-------------+------------+-------------+
| host | user | delete_priv | update_priv | alter_priv | insert_priv |
+-----------+--------+-------------+-------------+------------+-------------+
| localhost | root | Y | Y | Y | Y |
| 127.0.0.1 | root | Y | Y | Y | Y |
| localhost | | N | N | N | N |
| localhost | pma | N | N | N | N |
| localhost | careem | Y | Y | N | Y |
+-----------+--------+-------------+-------------+------------+-------------+
5 rows in set (0.00 sec)
mysql>
mysql> select host,user,delete_priv,update_priv,alter_priv,insert_priv
-> from user;
ERROR 1046 (3D000): No database selected
mysql> use mysql;
Database changed
mysql> select host,user,delete_priv,update_priv,alter_priv,insert_priv
-> from user;
+-----------+--------+-------------+-------------+------------+-------------+
| host | user | delete_priv | update_priv | alter_priv | insert_priv |
+-----------+--------+-------------+-------------+------------+-------------+
| localhost | root | Y | Y | Y | Y |
| 127.0.0.1 | root | Y | Y | Y | Y |
| localhost | | N | N | N | N |
| localhost | pma | N | N | N | N |
| localhost | careem | Y | Y | N | Y |
+-----------+--------+-------------+-------------+------------+-------------+
5 rows in set (0.00 sec)
mysql> revoke create,delete
-> on *.*
-> from 'careem'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user,delete_priv,update_priv,create_priv,alter_priv,insert_pr
iv
-> from user;
+-----------+--------+-------------+-------------+-------------+------------+---
----------+
| host | user | delete_priv | update_priv | create_priv | alter_priv | in
sert_priv |
+-----------+--------+-------------+-------------+-------------+------------+---
----------+
| localhost | root | Y | Y | Y | Y | Y
|
| 127.0.0.1 | root | Y | Y | Y | Y | Y
|
| localhost | | N | N | N | N | N
|
| localhost | pma | N | N | N | N | N
|
| localhost | careem | N | Y | N | N | Y
|
+-----------+--------+-------------+-------------+-------------+------------+---
----------+
5 rows in set (0.00 sec)
mysql> grant delete,create
-> on *.*
-> to 'careem'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user,delete_priv,update_priv,create_priv,alter_priv,insert_pr
iv
-> from user;
+-----------+--------+-------------+-------------+-------------+------------+---
----------+
| host | user | delete_priv | update_priv | create_priv | alter_priv | in
sert_priv |
+-----------+--------+-------------+-------------+-------------+------------+---
----------+
| localhost | root | Y | Y | Y | Y | Y
|
| 127.0.0.1 | root | Y | Y | Y | Y | Y
|
| localhost | | N | N | N | N | N
|
| localhost | pma | N | N | N | N | N
|
| localhost | careem | Y | Y | Y | N | Y
|
+-----------+--------+-------------+-------------+-------------+------------+---
----------+
5 rows in set (0.00 sec)
mysql> show grants for 'careem'@'localhost';
+-------------------------------------------------------------------------------
-----------------------------------------------------------------+
| Grants for careem@localhost
|
+-------------------------------------------------------------------------------
-----------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ON *.* TO 'careem'@'localhost' ID
ENTIFIED BY PASSWORD '*A1612E8F81B1D7D605E4D6074302E67B7A5531D0' |
+-------------------------------------------------------------------------------
-----------------------------------------------------------------+
1 row in set (0.00 sec)
mysql>
mysql> update user set alter_priv='Y';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 5 Changed: 3 Warnings: 0
mysql> select host,user,delete_priv,update_priv,create_priv,alter_priv,insert_pr
iv
-> from user;
+-----------+--------+-------------+-------------+-------------+------------+---
----------+
| host | user | delete_priv | update_priv | create_priv | alter_priv | in
sert_priv |
+-----------+--------+-------------+-------------+-------------+------------+---
----------+
| localhost | root | Y | Y | Y | Y | Y
|
| 127.0.0.1 | root | Y | Y | Y | Y | Y
|
| localhost | | N | N | N | Y | N
|
| localhost | pma | N | N | N | Y | N
|
| localhost | careem | Y | Y | Y | Y | Y
|
+-----------+--------+-------------+-------------+-------------+------------+---
----------+
5 rows in set (0.00 sec)
mysql>
mysql> select user,host,password from user;
+--------+-----------+-------------------------------------------+
| user | host | password |
+--------+-----------+-------------------------------------------+
| root | localhost | |
| root | 127.0.0.1 | |
| | localhost | |
| pma | localhost | |
| careem | localhost | *A1612E8F81B1D7D605E4D6074302E67B7A5531D0 |
+--------+-----------+-------------------------------------------+
5 rows in set (0.00 sec)
mysql> update user set password=password('careem') where user='careem';
Query OK, 1 row affected (0.05 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select user,host,password from user;
+--------+-----------+-------------------------------------------+
| user | host | password |
+--------+-----------+-------------------------------------------+
| root | localhost | |
| root | 127.0.0.1 | |
| | localhost | |
| pma | localhost | |
| careem | localhost | *7D9727ECE262E6AB1E16BD9727C428417E919BCB |
+--------+-----------+-------------------------------------------+
5 rows in set (0.00 sec)
mysql>
mysql> select user,host,password from user;
+--------+-----------+-------------------------------------------+
| user | host | password |
+--------+-----------+-------------------------------------------+
| root | localhost | |
| root | 127.0.0.1 | |
| | localhost | |
| pma | localhost | |
| careem | localhost | *A1612E8F81B1D7D605E4D6074302E67B7A5531D0 |
+--------+-----------+-------------------------------------------+
5 rows in set (0.00 sec)
mysql> update user set password=password('careem') where user='careem';
Query OK, 1 row affected (0.05 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select user,host,password from user;
+--------+-----------+-------------------------------------------+
| user | host | password |
+--------+-----------+-------------------------------------------+
| root | localhost | |
| root | 127.0.0.1 | |
| | localhost | |
| pma | localhost | |
| careem | localhost | *7D9727ECE262E6AB1E16BD9727C428417E919BCB |
+--------+-----------+-------------------------------------------+
5 rows in set (0.00 sec)
mysql>
C:\xampp\mysql\bin>mysql -u careem -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 76
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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> \q
Bye
C:\xampp\mysql\bin>mysql -u careem -p
Enter password: ******
ERROR 1045 (28000): Access denied for user 'careem'@'localhost' (using password:
YES)
C:\xampp\mysql\bin>mysql -u careem -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 78
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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>

Anda mungkin juga menyukai