Visar inlägg med etikett Create MySQL database via command line. Visa alla inlägg
Visar inlägg med etikett Create MySQL database via command line. Visa alla inlägg

måndag 10 juni 2013

Linux - Create MySQL database via command line

http://www.linux.org/

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!
#
#
#
#
1
#
#
#
#
#
#
#
#
#
#