Create a MySQL Database Using CLI
- SSH into your server.
- Log into MySQL as the root user.
- Create a new database user: Copy. GRANT ALL PRIVILEGES ON *. ...
- Log out of MySQL by typing: \q .
- Log in as the new database user you just created: Copy. mysql -u db_user -p. ...
- Create a new database: Copy. CREATE DATABASE db_name;