Membuat, Hapus, Edit User Mysql Server (MariaDB)

Panduan database cara membuat, edit, view dan hapus user password baru + hak akses mysql server atau mariaDB, ini berjalan lancar untuk mysql versions 5.7 – 8.xx

Silahkan masuk ke mysql / maria db:

Buat database baru (optional):

create database nama_db;

 

membuat user baru

CREATE USER 'user_baru'@'nama_host' IDENTIFIED BY 'password_baru';

Note: host IP_adress khusus akses database remote, jika server menjadi 1 server bisa pakai localhost.

 

Hak Akses

Buat hak akun dapat hak akses edit, hapus data atau yang lebih dikenal GRANT ALL PRIVILEGES.

GRANT ALL PRIVILEGES ON *.* TO 'nama_user'@'nama_host' WITH GRANT OPTION;

Revoke hapus hak akses user:

REVOKE ALL PRIVILEGES ON * . * FROM 'nama_user'@'nama_host';

 

View User

SELECT user,host FROM mysql.user;

Hasil:

+------------------+-----------+
| user | host |
+------------------+-----------+
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| santo | localhost |
| paijo | localhost |
| user_baru | localhost |
+------------------+-----------+
7 rows in set (0.01 sec)

 

Edit User

Ganti edit username / host:

RENAME USER seosatu@localhost TO seodua@remotehost;

Ganti / edi password:

ALTER USER 'user'@'hostname' IDENTIFIED WITH mysql_native_password BY 'password_baru';

 

Hapus User

Hapus user mysql / mariadb sama saja:

DROP USER 'username'@'host';

Tambahan hapus database:

Drop database nama_database;
READ :  Cara Mengatasi Error, Gagal Install webuzo VPS Linux NiagaHoster