Introduction to My SQL Overview by Ray Williams

Introduction to My. SQL Overview by Ray Williams CS 320/565 Marymount University

My. SQL Overview ¢ My. SQl is an Open Source Relational Database ¢ My. SQL was created by My. SQL AB in Sweden by: " David Axmark " Allan Larsson " Michael "Monty" Wiedenus The "Official" Site is http: //www. mysql. com ¢ " C o Note there is a current controversy where Progress Software and Nu. Sphere Corporation have set up another site http: //www. mysql. org in violation of the My. SQL Copyright

My. SQL Platforms My. SQL is available on a variety of platforms ¢ " Linux " Freed. BSD and Net. BSD " Solaris " SCO Unix " Win 32 " Windows. NT " OS/2

My. SQL Features ¢ Multithreaded ¢ ANSI SQL-92 Compliant ¢ Online Help ¢ Portability ¢ Many Application Programming Interfaces APIs " Perl " TCL " Python " Java (JDBC " ODBC " C++

My. SQL Architecture ¢ As a database My. SQL is a series of structured files that are organized in a highly efficient manner. ¢ By default the mysql database is created with the host, user and database privileges. Table Row Column Table

My. SQL Files and Directories ¢ Directories " Support-files - files to aid in installing and configuring " Bin - My. SQL commands " Data - Database data files " Include - All C header files " Tests - Perl scripts to test My. SQL " Lib - Library files used in C++ API " Scripts - Install scripts for My. SQL " Share - Error logs and messages " Mysql-bench - Home of crash. Me tool Files " " Chage. Log, INSTALL-BINARY, PUBLIC, README, manual. * (txt, htm)

Starting & Stopping My. SQL bin/safe_mysqld & ¢ " Starts the My. SQL daemon (server) under Unix/Linux mysqld. exe ¢ " Starts the My. SQL server under Windows bin/mysqladmin -p ping ¢ " Prompt for password (-p) and verify server daemon is running. bin/mysqladmin -p shutdown ¢ " Prompt for password and shutdown server

Using My. SQl ¢ To get into the command line: " bin/mysql -p ¢ To view installed databases " SHOW databases; ¢ To select a database " USE mysql; ¢ To view tables " SHOW TABLES FROM mysql; ¢ To view columns in a table " SHOW COLUMNS FROM user; " DESC user; or

Using My. SQL (cont. ) ¢ To create a new database " CREATE DATABASE sample_db; or " bin/mysqladmin -p CREATE sample_db; ¢ To delete a database " DROP DATABASE sample_db; " bin/mysqladmin -p DROP sample_db; ¢ To add a new user " INSERT INTO user VALUES('localhost', 'new_user', password('password'), 'Y', 'Y', 'Y', 'Y');

Using My. SQl (cont. ) ¢ INSERT INTO user VALUES('localhost', 'new_user', password('password'), 'Y', 'Y', 'Y', 'Y');

A Quick Run Thru My. SQL ¢ CREATE DATABASE temp; ¢ USE DATABASE temp; ¢ CREATE TABLE test_table (Test_ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Test_Name VARCHAR(30), Test_Date DATETIME, Test_Giver VARCHAR(30)); ¢ INSERT INTO test_table(Test_ID, Test_Name, Test_Date, Test_Giver) VALUES (NULL, 'Test', '2001 -10 -02', 'Beryl'); ¢ SELECT * FROM test_table;
- Slides: 11