[sourcecode language="bash"]mysql -uroot -p[/sourcecode]
kemudian masukkan password
Sebagai contoh, kita mau menambahkan user saifi dengan password = ahmada, maka perintahnya adalah
[sourcecode language="bash"]GRANT ALL ON *.* TO 'saifi'@'localhost' IDENTIFIED BY 'ahmada';[/sourcecode]
Note :
*.* artinya untuk semua database yang ada di server mysql
Untuk memastikan user berhasil dibuat :
q: >
[sourcecode language="bash"]use mysql;[/sourcecode]
[sourcecode language="bash"]select host,user,password from user where user = 'saifi';[/sourcecode]
q: >
keluar dulu dari environment mysql denget perintah exit
[sourcecode language="bash"]exit[/sourcecode]
[sourcecode language="bash"]mysql -usaifi -p;[/sourcecode]
kemudian masukkan password = ahmada
Untuk membuat user saifi bisa mengakses server mysql lewat host mana pun , update tabel user pada database mysql
[sourcecode language="bash"]update user set host='%' where user='saifi' and host='localhost';[/sourcecode]
[sourcecode language="bash"]flush privileges;[/sourcecode]
Selamat meng-Query ;D
No comments:
Post a Comment