Database Management

List database type the following command at mysql prompt
mysql> show databases;
Add database
CREATE DATABASE database_name;

User Management

List all users
mysql> select user, host from mysql.user
Add User and set privileges
mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' WITH GRANT OPTION;
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
Delete User
mysql> DROP USER 'testuser'@'localhost';
Give full privileges of a user to a database for localhost
mysql -u root
mysql > grant all privileges on mydatabase.* to myaccount@localhostĀ ;
Change root password (insecure)
mysqladmin -u root -p'oldpassword' password newpass