MySQL privileges

MySQL privileges notes :-

1. ล็อกอินฐานข้อมูลด้วยผู้ใช้รูท (with the root user login)

[sourcecode]mysql -h 127.0.0.1 -u root -p[/sourcecode]

Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 5.0.26

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

2. ตรวจสอบสิทธิ (view privileges)

[sourcecode]mysql> show grants for ‘root’@’localhost’;[/sourcecode]

3. กำหนดการให้สิทธิเฉพาะบ้างฐานข้อมูล (user gives permission to a specific database)

[sourcecode]mysql> grant select,insert,update,delete,create,drop on syslogadmin.* to ‘syslogadmin’@’localhost’ identified by ‘syslogadmin’;<b[/sourcecode]

หรือให้สิทธิทุกโฮสต์

[sourcecode]mysql> grant select,insert,update,delete,create,drop on syslogadmin.* to ‘syslogadmin’@’*’identified by ‘syslogadmin’;<b[/sourcecode]