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 snipplr.com, 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> FLUSH PRIVILEGES;
mysql> EXIT

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

Technorati Tags: , ,

Related posts:

  1. How to install a LAMP stack on Ubuntu Gutsy Gibbon (7.10)
  2. How to install ruby on rails on Ubuntu Gutsy Gibbon (7.10)
  3. How to work around the “no address associated with hostname.(SocketError)” when installing Rails
  4. How to get past the `require’: no such file to load — mkmf (LoadError) when installing the “mysql” gem
  5. How to get past the “Could not find rubygems-update (> 0) in any repository” Error

TAGS:

LEAVE A COMMENT

Subscribe Form

Subscribe to Blog

Sponsors

Recent Readers

JOIN MY COMMUNITY!
                 
                  Computers Blogs - Blog Top Sites