Dec 10 2007

How to create a MySQL database from the command-line client

If you're new here, you may want to start with my most popular posts. Then, subscribe to my RSS feed to stay updated. Thanks for visiting!

Google Query: create a mysql database from command line

Since, I just started dabbling in Ruby on Rails, I need to also deal with database software. My database of choice so far has been MySQL. I know this seems obvious to seasoned database programmers, but I always forget how to create a database from the command line MySQL client. This is probably because Ruby on Rails lets you manipulate the database through the Ruby language once the database is set up.

Thanks to, I found my answer. So, here it is as a reminder to myself. Hopefully, it will help some of you as well.

-Login to MySQL using the following command at the Terminal.
mysql -u ''adminusername'' -p

-Create the database and add privileges to a user by typing in the following at the “mysql>” prompt.
mysql> CREATE DATABASE ''databasename'';
mysql> GRANT ALL PRIVILEGES ON ''databasename''.* TO "''username''"@"''hostname''" -> IDENTIFIED BY "''password''";
mysql> EXIT

That’s it. Now I am reminded. Hopefully you are too.

Technorati Tags: , ,

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.



Subscribe Form

Subscribe to Blog


Recent Readers

                  Computers Blogs - Blog Top Sites