How to create a MySQL database from the command-line client
- 0 Comments
Welcome back!
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: MySQL, Ruby on Rails, Programming
Related posts:
Related posts brought to you by Yet Another Related Posts Plugin.

