Anthony
Anthony

Reputation: 1

Creating Simple Database in MySQL

all, I'm new to using MySQL and I'm having some issues creating a simple database for uploading a basic ruby app. Can anybody help me with the format to use in the MySQL Command? I'm using MySQL 5.5.

I have searched online; however, all of the typical formats for creating a database seem to have no result at all on prompt - should I be seeing some sort of visual confirmation that a database was created? Thanks, all!

Upvotes: 0

Views: 656

Answers (5)

numberwhun
numberwhun

Reputation: 956

When you issue the following command at the mysql prompt:

CREATE database <database_name>;

You should be presented with the typical "Ok" prompt afterwards. You should then be able to do :

show databases;

That will show you a list of databases on the system and in there you should see the database you created.

Upvotes: 0

mingos
mingos

Reputation: 24522

Yes, MySQL informs you of the result of each query. Here's what I've just got:

mysql> create database foo;

Query OK, 1 row affected (0.01 sec)

mysql> use foo;

Database changed

mysql> show tables;

Empty set (0.00 sec)

mysql>

If you need visual feedback, please consider downloading MySQL Workbench - it is easy to use and, as a GUI application, is explicit enough to make a new user feel comfortable.

Upvotes: 0

Jordan Running
Jordan Running

Reputation: 106077

The command for creating a database is CREATE DATABASE database_name;. Don't forget the semicolon at the end.

If it's successful you should see a message like Query OK, 1 row affected (0.00 sec). Any query should have at east this much output. If you see no message at all (e.g. you press enter and the next line just looks like a -> prompt) make sure you've closed all of your parentheses and quotation mark and ended the query with a semicolon (;).

Upvotes: 0

adamjmarkham
adamjmarkham

Reputation: 2164

Try doing DESCRIBE tablename where tablename is the name of a table you think you have created. That way you can check whether it was created or not.

Upvotes: 0

Caimen
Caimen

Reputation: 2619

As a new user I would highly recommend trying out phpMyAdmin as an interface to MySQL. I know it's not ruby, but if you have php setup already anyways it's a very useful tool.

http://www.phpmyadmin.net/home_page/index.php

With this tool, you can create a database with the click of a single button, run SQL commands, create tables and set permissions.

Upvotes: 1

Related Questions