Difference between revisions of "MySQL"

From Catatan IBM
Jump to navigation Jump to search
(Created page with "==GRANT ALL PRIVILEGES di MySQL 8== Buat yang biasa pakai MySQL versi sebelum 8, membuat user otomatis dan sekaligus meng-assign privileges biasanya cukup dilakukan dengan satu perintah: GRANT ALL PRIVILEGES ON yourdbname.* TO yourdbuser@localhost IDENTIFIED BY ‘yourdbpassword’; Di MySQL 8 sintaks ini akan memberikan error: 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...")
 
(Replaced content with "*Mysql: Grant all Privileges di Myql 8")
Tag: Replaced
Line 1: Line 1:
==GRANT ALL PRIVILEGES di MySQL 8==
*[[Mysql: Grant all Privileges di Myql 8]]
 
Buat yang biasa pakai MySQL versi sebelum 8, membuat user otomatis dan sekaligus meng-assign privileges biasanya cukup dilakukan dengan satu perintah:
GRANT ALL PRIVILEGES ON yourdbname.* TO yourdbuser@localhost IDENTIFIED BY ‘yourdbpassword’;
 
Di MySQL 8 sintaks ini akan memberikan error:
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 ‘IDENTIFIED BY ‘yourdbpassword” at line 1
 
Solusinya:
CREATE USER ‘yourdbuser’@’localhost’ IDENTIFIED BY ‘yourdbpassword’;
 
GRANT ALL PRIVILEGES ON yourdbname.* TO ‘yourdbuser’@’localhost’ WITH GRANT OPTION;
 
Tentu pastikan database nya sudah terbuat dahulu. Oiya behaviour lainnya adalah root mysql hanya bisa diakses dari user root dan bisa dilakukan tanpa password.

Revision as of 07:47, 18 January 2023