MySQL basic commands part 1
  
In this post I will show you some basic commands in MySQL. On start, you need to have MySQL installed because installation process is not covered. For installation on Windows x86 machines you can download MySQL from http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-essential-5.0.19-win32.msi/from/pickAfter downloading and installing start MySQL from Start->All Programs->MySQL->MySQL Server->MySQL Command Line Client. Command Prompt will open asking for password. If you haven't specified password during installation just press ENTER, otherwise enter password and hit ENTER. There will be shown "mysql>" and blinking blank sign waiting for entering commands.
Here we'll start with our first commands. We'll first check weather are there some databases with command: SHOW DATABASES;
-------------
few notes:
-------------
1. after most MySQL commands there must be sign ; (that specifies end of command (not just in MySQL))
2. you can hit enter even if you have wrote just SHOW, but on next line sign -> will be shown which requires from you to finish command
3. beside -> there are similiar like:
'> which requires you to finish ' string
"> which requires you to finish " string (second type of string)
and others, I woun't make hard on you now becouse of this :D
4. Every command in MySQL on WINDOWS is NOT case sensitive, meaning that SHOW DATABASES can be written as: Show Databases and there wouldn't be any mistakes. On the other hand on Linux they ARE case sensitive
-------------
Let's Continiue...

On that picture you can see list of my MySQL databases that are created for other purposes, but now we'll create our one.
The command is: CREATE DATABASE name_of_database (name our database "students" )
After creating, we want to add datas to our database. First we must select database which we'll use. We do that with command: use name_of_database (with or without ; doesn't mind, this is one of those minor number of commands that do not need ; for symboling the end of command)
so: USE students
and now we can write commands that will efect students database.
-----------------
other parts about MySQL:
MySQL basic commands part 2
MySQL basic commands part 3
MySQL basic commands part 4
Post a Comment