Mysql CLI basics
mysql -u root -p
This command is run in Shell / Bash and for security purposes I prefer never to provide the mysql password in command line and just giving it -p makes the mysql CLI prompt you for the password when you hit enter.
CREATE DATABASE test;
Typed from within the mysql CLI to create the DB called test.
GRANT ALL PRIVILEGES ON test.* TO [email protected] IDENTIFIED BY 'somepass';
Typed from within the Mysql CLI to create a user called test_user who can login from localhost only, using password somepass, and has all base privileges to all tables within database test.
GRANT ALL PRIVILEGES ON test.table1 TO [email protected] IDENTIFIED BY 'anotherpass';
Typed from within the Mysql CLI to create a user called another_user who can login from 192.168.1.68 only, using password anotherpass, and has all base privileges to one the table named table1 within database test.
mysqladmin -u root -p drop test
Typed in Shell / Bash, for a database called test and user called root, password will be prompted for after you hit enter.