MySQL Quick Guide

Download Report

Transcript MySQL Quick Guide

MySQL Quick Guide
Start and End MySQL
• MySQL is installed as a service.
• To start MySQL:
– Control Panel/Administrative Tools/Services/MySQL/
start
•
•
•
•
MySQL Administrator
MySQL Query Browser
MySQL Command Line Client
To stop MySQL:
– Control Panel/Administrative Tools/Services/MySQL/
Stop; Or
– MySQL Administrator/Services Control/Stop
Creating and Use a Database
• CREATE DATABASE mydb;
• USE mydb
Show
• SHOW DATABASES
– Show all databases
• SHOW TABLES
– List all tables in the default database
• SHOW COLUMNS FROM tableName
– List all columns in a given table.
Editing SQL Commands
• MySQL stores the most recent command.
We can edit the command as follow:
– Use the Up, Down arrow key to select and
correct the command, then press Enter.
Creating Command Files
• Use a text editor to create a file with SQL
commands and save it with extension .txt
• To run the command file:
– SOURCE commandFileName.txt
• Ex: mysql> source c:\MySQLCommand.txt
MySQL Query Browser
• Schemata
– Select a database schema to be the default database
• To create/delete a schema:
– Point to any schema and right click, then choose
create/delete schema
• To create a new script:
– File/New Script Tab
• To open a script:
– File/New Script
SQL Server Quick Guide
To Start/End SQL Server
• To start SQL Server service:SQL Server
Configuration manager
– All programs/MS SQL Server/Configuration
tools/SQL Sever Configuration Manager/SQL
Server 2005 Services/SQL Server
• Login to the server:
– All programs/MS SQL Server/SQL Server
Management Studio Express
Management Studio Express
• Object Explorer
– Databases
• System databases
• To create a new database:
– Point to the Databases folder icon and right
click, then choose New database
• Tool Bar:
– New Query
– Available databases drop-down list