Pertemuan 4 MySQL User Management
Pertemuan 4 MySQL User Management
AND SECURITY
Chapter 4
Contents of
mysql database
There are five tables that can be used to manage users and to set
user privileges (grant tables), namely: user, db, host, tables_priv
and columns_priv
User Management in MySQL
GRANT TABLES :
user table
This table contains the user data, the connection and the user access
privileges. Access level is Global.
structure of user table
User Management in MySQL
GRANT TABLES :
db table
Organizing the database access privileges by the user.
Access level is database.
structure of db table
User Management in MySQL
GRANT TABLES :
host table
Organizing the allowable host for the user to access MySQL, if more than
one host. Access level is database.
tables_priv table
Organizing the tables that can be accessed by the user and the type of
access privileges. Access level is table.
columns_priv table
Organizing the attributes (fields) that can be accessed by the user and
the type of access privileges. Access level is attribute (field).
User Management in MySQL
User Privileges type :
Normal user access levels
Includes access privileges at database or column level.
1. ALTER
2. CRETATE
3. DELETE
Administrator access level
4. DROP
5. INDEX Used only by root or administrator level users.
6. INSERT 1. FILE
7. SELECT 2. PROCESS
8. UPDATE 3. RELOAD
9. REFERENCE 4. SHUTDOWN
S 5. CREATE TEMPORARY TABLE
6. EXCUTE
7. LOCK TABLES
8. REPLICATION CLIENT
9. REPLICATION SLAVE
10. SHOW Special privileges level
DATABASES
11. SUPER Can be applied to each user
1. ALL
2. USAGE
User Management in MySQL
Anonymous and Root User
Anonymous user is user without identity and password. with an anonymous user,
mysql is accessible to anyone without a user name and password. therefore, this
user should be removed to keep the database secure (delete from user where
user=‘ ‘;). host consists of
Localhost : MySQL database can only be
accessed by local server computer
127.0.0.1 : by default, MySQL database will only
open its access to this IP
% : MySQL database can be accessed
Root User from any computer
Anonymous User
The root user (superuser) is the highest user level that can run any command in
MySQL. This user can run a query that serves to control, create a MySQL user,
restrict and administer user access privileges in the MySQL database.
This root user is automatically created during the first MySQL Server installation
with a blank password.
User Management in MySQL
Change the root password
The root password must be replaced in order for the database to be
secure.
Command to update the root user password is :
flush privileges;
The flush privileges command will instruct the server to reread the
access privileges table
User Management in MySQL
Add a new user
Adding a new user can be done by adding a record to the user table.
Insert into tbname values (........); user with name john does not have access privileges yet
Example :
example2
Remote host
example