Comment goes here
You should log in and post some comments! The link is up there in the toolbar. Go nuts!
 

Create MySQL database via command line

Often times you'll find yourself wanting to quickly create a database in your MySQL installation for some project you are working on. Follow this quick guide to do so.

We're going to create a database named 'testing' with a user named 'test_user' and a password of 'test_pass'. 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 testing;

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

All done!

Article Details

  • Author: Rob Kennedy
  • Publish Date: 05/10/2012
  • Last Updated: 05/10/2012
  • Categories: Linux Tips, Shell
  • Linux Tips and Tricks