Sunday, April 24, 2011

MySQL step by step lesson 2

¨After you have connected successfully, you can disconnect any time by typing QUIT (or \q) at the mysql> prompt:
  mysql> QUIT
  Bye
          or
  mysql>Exit

¨To see a list of options provided by mysql, invoke it with the help option:
  mysql> help          or    /h

Creating and Using a Database

¨Use the SHOW statement to find out what databases currently exist on the server:
  mysql> SHOW DATABASES;
¨To access any database use:
  mysql> USE test
  Database changed
ØCreate a text file to save your work                                                
mysql>TEE h:\commands.txt; (can give any name for the text file)-kind of a log file.

¨Type ‘\c’ to clear the buffer(/Clear the current input statement)
¨To create a database                                                      mysql>CREATE DATABASE dbbb;
¨Your commands should always end with a semicolon(;)
¨Spaces aren’t allowed in the names of databases & tables.So an underscore(_) can be used instead.                                         ex:db_cc

¨SQL is case insensitive.That means it’s not necessary to capitalize commands,but it’s considered as a good programming practice in SQL.
¨When naming  tables & databases stick to one naming covention.
¨To view all the available tables in your databases                               
     
mysql>SHOW TABLES;   

MySQL step by step lesson 1

¨MySQL is a database server
¨mysql (sometimes referred to as the “terminal monitor” or just “monitor”) is an interactive program that enables you to connect to a MySQL server (which contains databases.
¨In a database we have data (/data tables)
¨How we can evaluate/interpret those data?
¨So, we use queries to view results according to our needs.

Connecting and Disconnecting from the server

¨To connect to the server, you will usually need to provide a MySQL user name when you invoke mysql and, most likely, a password
¨If the server runs on a machine other than the one where you log in(localhost), you will also need to specify a host name.
¨Once you know the proper parameters, you should be able to connect like this:
                             shell> mysql –h host -u user -p
        Enter password: ********
¨host and user represent the host name where your MySQL server is running and the user name of your MySQL account

¨If you are logging in on the same machine that MySQL is running on, you can omit the host, and simply use the following:
  shell> mysql -u user –p
¨Some MySQL installations permit users to connect as the anonymous (unnamed) user to the server running on the local host. If this is
  the case on your machine, you should be able to connect to that server by invoking mysql without any options:
  shell> mysql







DBMS in short with MySQL

How to login to your MySql account

Set the path  to where you installed the mysql server and mysql terminal monitor is available  
                 set path= H:\ 
Type  (username should be your registration number)       
                mysql -h auth -u username -p     ->press enter
Enter password                                           
              ***********  ->press enter
Then login to your database                                          

Installing MYSQL Server (Windows Version)

Following set of photos show you the sequence of steps in installing MYSQL Server 5.0