ตรวจสอบข้อมูล user ในฐานข้อมูลบน MariaDB

ในการตรวจสอบข้อมูลของ user ในระบบฐานข้อมูลนี้  เพื่อตรวจสอบความปลอดภัยของอยู่เป็นไปตามที่กำหนดของผู้ดูแลหรือไม่  ซึ่งคำสั่งที่เราจะใช้ในที่นี้จะไม่อยุ่งยากอะไร  แต่ได้ประสิทธิภาพในการทำงาน  มาดูกันเลยว่าจะใช้คำสั่งใดบ้าง

use  เป็นคำสั่งในการเลือกใช้ฐานข้อมูลที่เราต้อง
select  เป็นระบุสิ่งที่ต้องการนำขึ้นมาแสดงให้เห็น

เราจะได้เรียนรู้แบบละเอียดในครั้งต่อไปนะครับ  ตอนนี้เรารู้แบบคราวๆ ก่อนนะครับ  ค่อยๆ เรียนรู้แล้วจะสนุก

รูปแบบการใช้ เช่น
use mysql
select host, user, password from user;

เช่นเดิมเราจะเข้าใช้งานโดยสิทธิ์ root นั้นเอง  สำหรับใครยังไม่เข้าใจการเข้าใช้งานย้อนไปดูได้  ที่นี่
แล้วเราจะพิมพ์คำสั่ง   use mysql  ตามด้วย  select host, user, password from user; เท่านี้ก็สามารถเรียกข้อมูลของ user ขึ้นมาตรวจสอบได้แล้ว  มาดูคำสั่งแบบเต็มกัน

 

C:\>cd "Program Files\MariaDB 10.1\bin"

C:\Program Files\MariaDB 10.1\bin>mysql -u root -p
Enter password: ********
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.14-MariaDB mariadb.org binary distribution

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

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

MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]> select host, user, password from user;
+---------------+------+------------------------------------------------------------ --+
| host            | user | password                                                            |
+---------------+------+---------------------------------------------------------------+
| localhost      | root | *D31F778617FA8FBBA6BF4975510822488EA4D323 |
| bioboom-pc  | root | *D31F778617FA8FBBA6BF4975510822488EA4D323 |
| 127.0.0.1     | root | *D31F778617FA8FBBA6BF4975510822488EA4D323 |
| ::1              | root | *D31F778617FA8FBBA6BF4975510822488EA4D323 |
+---------------+------+---------------------------------------------------------------+
4 rows in set (0.03 sec)

MariaDB [mysql]>

สังเกตว่าบรรทัดที่เราใช้คำสัง use mysql  แล้ว command prompt จะถูกเปลี่ยนจาก 
MariaDB [(none)]>  เป็น  MariaDB [mysql]> ซึ่งเป็นการเปลี่ยนไปใช้ mysql database นั่นเอง





ไม่มีความคิดเห็น

ขับเคลื่อนโดย Blogger.