mysql -u root -h localhost -p mysql> CREATE DATABASE mydb; mysql> CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; mysql> GRANT ALL PRIVILEGES ON mydb.* TO 'user'@'hostname' IDENTIFIED BY 'password';