Note: IIS (Web Server) and PHP (Script engine) are
NOT required to install or run MySQL.
Installing MySQL on Windows Installing MySQL Step 1: Download the most recent version of the MySQL for Windows installer from http://www.mysql.org/ , and run it. Select the directory to which you would like to install MySQL (c:mysql).
Installing MySQL on Windows Installing MySQL
Step 2: Select the setup type that you would like to use. The
“ typical” should be sufficient for just about everybody. It
installs all items, including:
The Mysql Servers
Clients and maint. tools
Examples and Libraries
Grants tables and core
Installing MySQL on Windows Installing MySQL Step 3: That’s it! Click finish and you’re done installing (it really is just that simple)
Installing MySQL on Windows Running MySQL You must manually start MySQL the first time. c:mysqlinwinmysqladmin.exe You will be prompted to create an admin username and Password. This is the login information for the admin tool, not any specific database or table. Once the admin account is created, the server will be running (either as a program in Win 9x or as a service in NT) and will run each time you start Windows. The “traffic light” system tray icon shows you its working.
Installing MySQL on Windows Running MySQL Run the MySQL command interface by executing c:mysqlinmysql.exe Type show databases; to See the current databases Configured on the server. By default, “mysql” and “ test” should be there. Type use test; to specify that database.
Installing MySQL on Windows Running MySQL Let’s create a table. Type show tables; to see Currently defined tables in “ test”. Issue create table command to create a table. Now run show tables; again to verify what you’ve done. create table tablename ( column datatype );
Installing MySQL on Windows Running MySQL Insert some data into the table you’ve just created using the “insert into” SQL command. Verify the insert by “selecting” the information back out. insert into tablename ( field1, field2,… ) values ( value1, value2,… ); select [list of fieldnames or *] from tablename;
Installing MySQL on Windows Testing with PHP The true measure of success (requires PHP and web server) Put it all together. PHP Functions: mysql_connect( host[,user,pass] ) mysql_select_db( database ) mysql_query( SQL stmt ); mysql_close( database handle );
Installing MySQL on Windows Testing with PHP
Installing PHP on Windows Useful Links This Presentation http:// uts.cc.utexas.edu/~mpbarras/php / Download MySQL http://www.mysql.com/downloads/mysql-4.0.html Installation Documentation http://www.mysql.com/documentation/index.html PHP reference for MySQL functions http://www.php.net/manual/en/ref.mysql.php
BASIC SQL COMMANDS SQL STATEMENTS: T here are a number of SQL statements, few of which are explained below: Data Retrieval Statement: SELECT is the data extracting statement which retrieves the data from the database. Data Manipulation Language (DML): This language constitutes the statements that are used to manipulate with the data. It has three commands, which are INSERT, UPDATE and DELETE. Data Definition Language (DDL): This is the language used to define the tables. It sets up, changes, and removes data structures from the tables. It uses 5 commands, which are CREATE, ALTER, DROP, RENAME and TRUNCATE.
CREATING A TABLE
Syntax: Create table <Table Name> ( <Field1> <Type> <(width)> [Not Null/Null], <Field2> <Type> <(width)> [Not Null/Null], ..................................) : Example: Create table student_table (Reg_No Text (6) Name Text (25), Class Text (5));
CREATING A TABLE WITH PRIMARY KEY
Syntax: Create table <Table Name> ( <Field1> <Type> <(width)> Constraint <constraint name> Primary Key , <Field2> <Type> <(width)>, ..................................) : Example: a) Create table student_table2 (Reg_no Text (4) Constraint student_Reg_pk primary key, Name Text (25), Class Text (5));