Create MySQL database via command line.

Create quickly database in your MySQL installation for some project you are working on. Follow this quick guide to do.

We’re going to create a database named ‘itjagat’ with a user named itjagat_user and a password of ‘itjagat123’. We’re going to give him all privileges on this database and allow him to connect only from localhost.
First, log into the mysql shell as a privileged user:

root@localhost:~# mysql -u root -p

Now, create your database.
mysql> CREATE DATABASE itjagat;

Now, add your user and his access:
mysql> GRANT ALL PRIVILEGES ON testing.* TO itjagat_user@localhost
IDENTIFIED BY ‘password‘;


About the Author

Leave a Reply