This shows you the differences between two versions of the page.
— |
web_services:mysql_notes [2016/12/19 14:25] (current) tschulz created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== MySQL Notes ====== | ||
+ | |||
+ | ===== Change root password ===== | ||
+ | <file mysql> | ||
+ | use mysql; | ||
+ | UPDATE user SET Password=PASSWORD('<PASSWORD>') WHERE User='root'; FLUSH PRIVILEGES; exit; | ||
+ | flush privileges; | ||
+ | </file> | ||
+ | |||
+ | ===== Create User ===== | ||
+ | <file mysql> | ||
+ | CREATE USER '<USERNAME>'@'%' IDENTIFIED BY '<PASSWORD>'; | ||
+ | flush privileges; | ||
+ | </file> | ||
+ | |||
+ | ===== Grant Full Access to a Database ===== | ||
+ | <file mysql> | ||
+ | GRANT ALL PRIVILEGES ON <DBNAME>.* TO '<USERNAME>'@'%' WITH GRANT OPTION; | ||
+ | flush privileges; | ||
+ | </file> | ||
+ | |||
+ | ===== Check Grants for a User ===== | ||
+ | <file mysql> | ||
+ | SHOW GRANTS FOR '<USERNAME>'@'%' | ||
+ | </file> | ||
+ | |||