mysql -u root -p -e "GRANT ALL PRIVILEGES ON appdb.* TO 'app'@'localhost';"

Category: Databases & SQL

mysql -u root -p -e "GRANT ALL PRIVILEGES ON appdb.* TO 'app'@'localhost';"

Grant all privileges on one database

Gives the app user every privilege on appdb's tables and routines but nothing outside that database, a sensible least-privilege shape. Use appdb.* rather than *.* unless the account truly needs everything.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.