MySQL: Grant all Privileges di MySQL 8
Revision as of 07:49, 18 January 2023 by Ibm (talk | contribs) (Ibm moved page Mysql: Grant all Privileges di Myql 8 to MySQL: Grant all Privileges di MySQL 8)
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 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.