SlideShare a Scribd company logo
-By V.Gouthaman.
INTRODUCTION MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. The MySQL development project has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements. MySQL is owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, now owned by Sun Microsystems, a subsidiary of Oracle Corporation.
Members of the MySQL community have created several forks such as Drizzle and MariaDB. Both forks were in progress before the Oracle acquisition (Drizzle was announced 8 months before the Sun acquisition). Free-software projects that require a full-featured database management system often use MySQL. Such projects include (for example) WordPress, phpBB, Drupal and other software built on the LAMP software stack. MySQL is also used in many high-profile, large-scale World Wide Web products including Wikipedia, Google and Facebook.
INSTALLING  MYSQL
Install MySQL 5.0 Community Edition on Windows Step 1 : Download MySQL 5.0 Community Edition to your Desktop from  “http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.45-win32.zip/from/pick#mirrors”. Make sure you always download the “Complete package “.
Step 2 : Unzip mysql-5.0.45-win32.zip (the downloaded mysql file) to get Setup.exe. Double click Setup.exe to start installing MySQL. Click “Next ” when you are prompted as below.
Step 3 :  Select “Typical” for Setup Type and click “Next ” again.
Step 4 :  Click “Install ” to proceed with the installation process.
Step 5 :  The setup activity will show you some advertisement. Read it if you wish and click “Next “.
Step 6:  Tick “Configure the MySQL Server now” and click “Next ” two times.
 
Step 7:  Click “Standard Configuration” to ease installation process and click “Next ” again.
Step 8 :  Tick “Install As Windows Service” to make MySQL auto-startup with Windows and “Include Bin Directory in Windows PATH ” to make MySQL system files automatically available for other  application.
Step 9 :  Tick “Modify Security Settings” and enter a root (Administrator) password to secure your MySQL installation. Don’t skip this step! Click “Next ” again.
Step 10 :  Click “Execute” to start the MySQL Configuration process. Once finished, click “Finish ” to end configuration.
 
Step 11:   Make sure MySQL runs automatically after installation. You can check the status from Administrative Tools Services snap in (Start -> Programs -> Administrative Tools -> Services ), also available via Control Panel .
Step 12 :   (OPTIONAL) Open your DOS command prompt (Run -> cud). Type in “net stat -na“. Check out ports opened by MySQL (3306) and Apache (80) . That means the services are up and running.
Step 13 :  (OPTIONAL) Run some of MySQL commands to further ensure that the installation is a success. Check out and follow the commands as pictured below. User account is root and password depends on what you have entered previously during your MySQL configuration.
Step 14 :   IMPORTANT:  Reboot your machine!  This is to ensure all MySQL system files are rss-read by Windows as environment variables.
QUERY  COMMANDS  IN MYSQL
CREATE Command The Create command is used to create a table by specifying the tablename, fieldnames and constraints as shown below:  Syntax: $createSQL=("CREATE TABLE tblName"); Example: $createSQL=("CREATE TABLE tblstudent(fldstudid int(10) NOTNULL AUTO_INCREMENT PRIMARY KEY,fldstudName VARCHAR(250) NOTNULL,fldstudentmark int(4) DEFAULT '0' ");
SELECT Command The Select command is used to select the records from a table using its field names. To select all the fields in a table, '*' is used in the command. The result is assigned to a variable name as shown below: Syntax: $selectSQL=("SELECT field_names FROM tablename"); Example: $selectSQL=("SELECT * FROM tblstudent");
DELETE Command The Delete command is used to delete the records from a table using conditions as shown below: Syntax: $deleteSQL=("DELETE * FROM tablename WHERE condition");  Example: $deleteSQL=("DELETE * FROM tblstudent WHERE fldstudid=2");
INSERT Command The Insert command is used to insert records into a table. The values are assigned to the field names as shown below: Syntax: $insertSQL=("INSERT INTO tblname(fieldname1,fieldname2..) VALUES(value1,value2,...) ");  Example: $insertSQL=("INSERT INTO Tblstudent(fldstudName,fldstudmark)VALUES(Baskar,75) ");
UPDATE Command The Update command is used to update the field values using conditions. This is done using 'SET' and the fieldnames to assign new values to them.  Syntax: $updateSQL=("UPDATE Tblname SET (fieldname1=value1,fieldname2=value2,...) WHERE fldstudid=IdNumber"); Example: $updateSQL=("UPDATE Tblstudent SET (fldstudName=siva,fldstudmark=100) WHERE fldstudid=2");
DROP Command The Drop command is used to delete all the records in a table using the table name as shown below:  Syntax: $dropSQL=("DROP tblName");  Example: $dropSQL=("DROP tblstudent");
Login to MySQL monitor   Syntax: ..\mysql\bin\mysql -u[username] -p[password] Example: ..\mysql\bin\mysql -uroot -pmysecret
Create a database on the sql server. Syntax: CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name [create_specification] ... create_specification: [DEFAULT] CHARACTER SET [=] charset_name [DEFAULT] COLLATE [=] collation_name Example: u-1@srv-1 mysqlart $ mysql -u root Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 5 to server version: 4.0.14-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create database sysops; Query OK, 1 row affected (0.00 sec) mysql> quit Bye u-1@srv-1 mysqlart $
Switch to a database. mysql> use [db name];
mysql> show tables; To see all the tables in the database
CREATE TABLE SYNTAX: CREATE TABLE [table_name] ( [column_name1] INT AUTO_INCREMENT, [column_name2] VARCHAR(30) NOT NULL, [column_name3] ENUM('guest', 'customer', 'admin')NULL, [column_name4] DATE NULL, [column_name5] VARCHAR(30) NOT NULL, [column_name6] DATETIME NOT NULL, [column_name7] CHAR(1) NULL, [column_name8] BLOB NULL, [column_name9] TEXT NOT NULL, UNIQUE(username), PRIMARY KEY (column_name1) Example: CREATE TABLE user ( userid INT AUTO_INCREMENT, username VARCHAR(30) NOT NULL, group_type ENUM('guest', 'customer', 'admin') NULL, date_of_birth DATE NULL, password VARCHAR(30) NOT NULL, registration_date DATETIME NOT NULL, account_disable CHAR(1) NULL, image BLOB NULL, comment TEXT NOT NULL, UNIQUE(username), PRIMARY KEY (userid) );
INSERT  STATEMENTS Syntax: INSERT INTO table_name ( `col_A`, `col_B`, `col_C`) VALUES ( `col_A_data`, `col_B_data`, `col_C_data`) ; Example: INSERT INTO music ( 'id', `artist`, `album`) VALUES ( '1', `the beatles`, `Abbey Road`);
REPLACE  STATEMENTS Syntax: REPLACE INTO table_name ( `col_A`, `col_B`) VALUES ( `col A data`, `col B data`) ;  Example: REPLACE INTO music ( 'id', `artist`, `album`) VALUES ( '1', `the beatles`, `abbey road`);
UPDATE STATEMENTS  Syntax: UPDATE table_name SET col_B='new_data'  WHERE col_A='reference_data' ;  Example: UPDATE music SET title='Come Together' WHERE id=1;
Add a new column "male" in table user. Syntax: ALTER TABLE [table_name] ADD COLUMN [column_name] CHAR(1) NOT NULL; Example: ALTER TABLE user ADD COLUMN male CHAR(1) NOT NULL;
Change column name "male" into "gender" in table user and change the type to VARCHAR(3) and allow NULL values. Syntax: ALTER TABLE [table_name] CHANGE [old_column] [new_column] VARCHAR(3) NULL; Example: ALTER TABLE user CHANGE male gender VARCHAR (3) NULL;
Change the size of column "gender" from 3 to 6 in table user. Syntax: ALTER TABLE [table_name] MODIFY [column_name] VARCHAR(6); Example: ALTER TABLE user MODIFY gender VARCHAR(6);
SELECT STATEMENTS Syntax: SELECT * FROM table_name WHERE 1 ; Example: SELECT * FROM music WHERE 1;
DELETE STATEMENTS Syntax: DELETE FROM table_name WHERE column_name='search_data'; Example: DELETE FROM music WHERE artist='the beatles';
Show field formats of the selected table. Syntax: DESCRIBE [table_name]; Example: DESCRIBE mos_menu;
To see database's field formats. mysql> describe [table name];
To delete a database. Syntax: mysql> drop database [database name]; Example: DROP DATABASE demodb;
To delete a table. mysql> drop table [table name]; Example: DROP TABLE user;
Show all data in a table. mysql> SELECT * FROM [table name]; Example: SELECT * FROM mos_menu;
Show all records from mos_menu table containing name "Home". SELECT * FROM [table_name] WHERE [field_name]=[value]; Example: SELECT * FROM mos_menu WHERE name = "Home";
Returns the columns and column information pertaining to the designated table. mysql> show columns from [table name];
Show certain selected rows with the value "whatever". mysql> SELECT * FROM [table name] WHERE [field name] = "whatever";
Show all records containing the name "Bob" AND the phone number '3444444'. mysql> SELECT * FROM [table name] WHERE name = "Bob" AND phone_number = '3444444';
Show all records not containing the name "Bob" AND the phone number '3444444' order by the phone_number field. mysql> SELECT * FROM [table name] WHERE name != "Bob" AND phone_number = '3444444' order by phone_number;
Show all records starting with the letters 'bob' AND the phone number '3444444'. mysql> SELECT * FROM [table name] WHERE name like "Bob%" AND phone_number = '3444444';
Show all records starting with the letters 'bob' AND the phone number '3444444' limit to records 1 through 5. mysql> SELECT * FROM [table name] WHERE name like "Bob%" AND phone_number = '3444444' limit 1,5;
Use a regular expression to find records. Use "REGEXP BINARY" to force case-sensitivity. This finds any record beginning with a. mysql> SELECT * FROM [table name] WHERE rec RLIKE "^a";
Show unique records. mysql> SELECT DISTINCT [column name] FROM [table name];
Show selected records sorted in an ascending (asc) or descending (desc). mysql> SELECT [col1],[col2] FROM [table name] ORDER BY [col2] DESC;
Return number of rows. mysql> SELECT COUNT(*) FROM [table name];
Sum column. mysql> SELECT SUM(*) FROM [table name];
Join tables on common columns. mysql> select lookup.illustrationid, lookup.personid,person.birthday from lookup left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id;
Creating a new user. Login as root. Switch to the MySQL db. Make the user. Update privs. # mysql -u root -p mysql> use mysql; mysql> INSERT INTO user (Host,User,Password) VALUES('%','username',PASSWORD('password')); mysql> flush privileges;
Change a users password from unix shell. # [mysql dir]/bin/mysqladmin -u username -h hostname.blah.org -p password 'new-password'
Change a users password from MySQL prompt. Login as root. Set the password. Update privs. # mysql -u root -p mysql> SET PASSWORD FOR 'user'@'hostname' = PASSWORD('passwordhere'); mysql> flush privileges;
Recover a MySQL root password. Stop the MySQL server process. Start again with no grant tables. Login to MySQL as root. Set new password. Exit MySQL and restart MySQL server. # /etc/init.d/mysql stop # mysqld_safe --skip-grant-tables & # mysql -u root mysql> use mysql; mysql> update user set password=PASSWORD("newrootpassword") where User='root'; mysql> flush privileges; mysql> quit # /etc/init.d/mysql stop # /etc/init.d/mysql start
Set a root password if there is on root password. # mysqladmin -u root password newpassword
Update a root password. # mysqladmin -u root -p oldpassword newpassword
Allow the user "bob" to connect to the server from localhost using the password "passwd". Login as root. Switch to the MySQL db. Give privs. Update privs. # mysql -u root -p mysql> use mysql; mysql> grant usage on *.* to bob@localhost identified by 'passwd'; mysql> flush privileges;
Give user privilages for a db. Login as root. Switch to the MySQL db. Grant privs. Update privs. # mysql -u root -p mysql> use mysql; mysql> INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES ('%','databasename','username','Y','Y','Y','Y','Y','N'); mysql> flush privileges; or mysql> grant all privileges on databasename.* to username@localhost; mysql> flush privileges;
To update info already in a table. mysql> UPDATE [table name] SET Select_priv = 'Y',Insert_priv = 'Y',Update_priv = 'Y' where [field name] = 'user';
Delete a row(s) from a table. mysql> DELETE from [table name] where [field name] = 'whatever';
Update database permissions/privilages. mysql> flush privileges;
Delete a column. mysql> alter table [table name] drop column [column name];
Add a new column to database. mysql> alter table [table name] add column [new column name] varchar (20);
Change column name. mysql> alter table [table name] change [old column name] [new column name] varchar (50);
Make a unique column so you get no dupes. mysql> alter table [table name] add unique ([column name]);
Make a column bigger. mysql> alter table [table name] modify [column name] VARCHAR(3);
Delete unique from table. mysql> alter table [table name] drop index [colmn name];
Load a CSV file into a table. mysql> LOAD DATA INFILE '/tmp/filename.csv' replace INTO TABLE [table name] FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (field1,field2,field3);
Dump all databases for backup. Backup file is sql commands to recreate all db's. # [mysql dir]/bin/mysqldump -u root -ppassword --opt >/tmp/alldatabases.sql
Dump one database for backup. # [mysql dir]/bin/mysqldump -u username -ppassword --databases databasename >/tmp/databasename.sql
Dump a table from a database. # [mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql
Restore database (or database table) from backup. # [mysql dir]/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql
 
Ad

More Related Content

What's hot (20)

MySQL and its basic commands
MySQL and its basic commandsMySQL and its basic commands
MySQL and its basic commands
Bwsrang Basumatary
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
farwa waqar
 
MySql:Introduction
MySql:IntroductionMySql:Introduction
MySql:Introduction
DataminingTools Inc
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
Stewart Rogers
 
MySQL ppt
MySQL ppt MySQL ppt
MySQL ppt
AtharvaSawant10
 
SQL commands
SQL commandsSQL commands
SQL commands
GirdharRatne
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
webhostingguy
 
Sql Server Basics
Sql Server BasicsSql Server Basics
Sql Server Basics
rainynovember12
 
Sql commands
Sql commandsSql commands
Sql commands
Balakumaran Arunachalam
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDB
valuebound
 
MYSQL join
MYSQL joinMYSQL join
MYSQL join
Ahmed Farag
 
Basic SQL and History
 Basic SQL and History Basic SQL and History
Basic SQL and History
SomeshwarMoholkar
 
MS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTUREMS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTURE
Douglas Bernardini
 
Sql commands
Sql commandsSql commands
Sql commands
Pooja Dixit
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
Nicole Ryan
 
Stored procedure
Stored procedureStored procedure
Stored procedure
baabtra.com - No. 1 supplier of quality freshers
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
Sachidananda M H
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
metsarin
 
MySQL for beginners
MySQL for beginnersMySQL for beginners
MySQL for beginners
Saeid Zebardast
 
My Sql Work Bench
My Sql Work BenchMy Sql Work Bench
My Sql Work Bench
Lahiru Danushka
 

Viewers also liked (20)

MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
webhostingguy
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
Giuseppe Maxia
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and Concepts
Tuyen Vuong
 
CBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationCBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL Presentation
Guru Ji
 
MySQL Introduction
MySQL IntroductionMySQL Introduction
MySQL Introduction
mysql content
 
Mysql ppt
Mysql pptMysql ppt
Mysql ppt
Sanmuga Nathan
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
Karmatechnologies Pvt. Ltd.
 
Dbms slides
Dbms slidesDbms slides
Dbms slides
rahulrathore725
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
Bradley Holt
 
Database management system presentation
Database management system presentationDatabase management system presentation
Database management system presentation
sameerraaj
 
MYSQL
MYSQLMYSQL
MYSQL
Ankush Jain
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
webhostingguy
 
Mysql an introduction
Mysql an introductionMysql an introduction
Mysql an introduction
Mohd yasin Karim
 
Mysql introduction
Mysql introduction Mysql introduction
Mysql introduction
Prof. Wim Van Criekinge
 
Data base management system
Data base management systemData base management system
Data base management system
Navneet Jingar
 
Open Source Package PHP & MySQL
Open Source Package PHP & MySQLOpen Source Package PHP & MySQL
Open Source Package PHP & MySQL
kalaisai
 
Dbms
DbmsDbms
Dbms
sevtap87
 
Sql ppt
Sql pptSql ppt
Sql ppt
Anuja Lad
 
Alphorm.com Support de la Formation PHP MySQL
Alphorm.com Support de la Formation PHP MySQLAlphorm.com Support de la Formation PHP MySQL
Alphorm.com Support de la Formation PHP MySQL
Alphorm
 
MySQL partitions tutorial
MySQL partitions tutorialMySQL partitions tutorial
MySQL partitions tutorial
Giuseppe Maxia
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and Concepts
Tuyen Vuong
 
CBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationCBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL Presentation
Guru Ji
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
Bradley Holt
 
Database management system presentation
Database management system presentationDatabase management system presentation
Database management system presentation
sameerraaj
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
webhostingguy
 
Data base management system
Data base management systemData base management system
Data base management system
Navneet Jingar
 
Open Source Package PHP & MySQL
Open Source Package PHP & MySQLOpen Source Package PHP & MySQL
Open Source Package PHP & MySQL
kalaisai
 
Alphorm.com Support de la Formation PHP MySQL
Alphorm.com Support de la Formation PHP MySQLAlphorm.com Support de la Formation PHP MySQL
Alphorm.com Support de la Formation PHP MySQL
Alphorm
 
MySQL partitions tutorial
MySQL partitions tutorialMySQL partitions tutorial
MySQL partitions tutorial
Giuseppe Maxia
 
Ad

Similar to MySQL (20)

My sql presentation
My sql presentationMy sql presentation
My sql presentation
Nikhil Jain
 
Sah
SahSah
Sah
sahul azzez m.i
 
Raj mysql
Raj mysqlRaj mysql
Raj mysql
firstplanet
 
MYSQL
MYSQLMYSQL
MYSQL
ARJUN
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
NIRMAL FELIX
 
MySQL Presentation
MySQL PresentationMySQL Presentation
MySQL Presentation
Manish Bothra
 
My sql.ppt
My sql.pptMy sql.ppt
My sql.ppt
MAGNA COLLEGE OF ENGINEERING
 
My sql Syntax
My sql SyntaxMy sql Syntax
My sql Syntax
Reka
 
mysqlHiep.ppt
mysqlHiep.pptmysqlHiep.ppt
mysqlHiep.ppt
webhostingguy
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfmysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
pradnyamulay
 
Complete SQL in one video by shradha.pdf
Complete SQL in one video by shradha.pdfComplete SQL in one video by shradha.pdf
Complete SQL in one video by shradha.pdf
rahulashu699
 
My sql
My sqlMy sql
My sql
Nadhi ya
 
Using Mysql.pptx
Using Mysql.pptxUsing Mysql.pptx
Using Mysql.pptx
StephenEfange3
 
Msql
Msql Msql
Msql
ksujitha
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
Reka
 
mySQL and Relational Databases
mySQL and Relational DatabasesmySQL and Relational Databases
mySQL and Relational Databases
webhostingguy
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
poornima sugumaran
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
poornima sugumaran
 
Mysql cheatsheet
Mysql cheatsheetMysql cheatsheet
Mysql cheatsheet
Adolfo Nasol
 
Creating database using sql commands
Creating database using sql commandsCreating database using sql commands
Creating database using sql commands
Belle Wx
 
Ad

More from Gouthaman V (20)

Professional Ethics Assignment II
Professional Ethics Assignment IIProfessional Ethics Assignment II
Professional Ethics Assignment II
Gouthaman V
 
Dip Unit Test-I
Dip Unit Test-IDip Unit Test-I
Dip Unit Test-I
Gouthaman V
 
Scholastic averages sheet-2
Scholastic averages sheet-2Scholastic averages sheet-2
Scholastic averages sheet-2
Gouthaman V
 
Eligibility criteria and instructions for Infosys Placement
Eligibility criteria and instructions for Infosys PlacementEligibility criteria and instructions for Infosys Placement
Eligibility criteria and instructions for Infosys Placement
Gouthaman V
 
Answers for 2 Marks Unit Test I (RMW)
Answers for 2 Marks Unit Test I (RMW)Answers for 2 Marks Unit Test I (RMW)
Answers for 2 Marks Unit Test I (RMW)
Gouthaman V
 
Anwers for 2 marks - RMW
Anwers for 2 marks - RMWAnwers for 2 marks - RMW
Anwers for 2 marks - RMW
Gouthaman V
 
Rmw unit test question papers
Rmw unit test question papersRmw unit test question papers
Rmw unit test question papers
Gouthaman V
 
Circular and semicircular cavity resonator
Circular and semicircular cavity resonatorCircular and semicircular cavity resonator
Circular and semicircular cavity resonator
Gouthaman V
 
VLSI Anna University Practical Examination
VLSI Anna University Practical ExaminationVLSI Anna University Practical Examination
VLSI Anna University Practical Examination
Gouthaman V
 
HCL IPT
HCL IPTHCL IPT
HCL IPT
Gouthaman V
 
VLSI Sequential Circuits II
VLSI Sequential Circuits IIVLSI Sequential Circuits II
VLSI Sequential Circuits II
Gouthaman V
 
VI Semester Examination Time Table
VI Semester Examination Time TableVI Semester Examination Time Table
VI Semester Examination Time Table
Gouthaman V
 
Antenna and Wave Propagation Assignment I
Antenna and Wave Propagation Assignment IAntenna and Wave Propagation Assignment I
Antenna and Wave Propagation Assignment I
Gouthaman V
 
Antenna and Wave Propagation Assignment I
Antenna and Wave Propagation Assignment IAntenna and Wave Propagation Assignment I
Antenna and Wave Propagation Assignment I
Gouthaman V
 
Computer Networks Unit Test II Questions
Computer Networks Unit Test II QuestionsComputer Networks Unit Test II Questions
Computer Networks Unit Test II Questions
Gouthaman V
 
Sequential Circuits I VLSI 9th experiment
Sequential Circuits I VLSI 9th experimentSequential Circuits I VLSI 9th experiment
Sequential Circuits I VLSI 9th experiment
Gouthaman V
 
Antenna Unit Test II Questions
Antenna Unit Test II QuestionsAntenna Unit Test II Questions
Antenna Unit Test II Questions
Gouthaman V
 
Antenna Unit Test II questions
Antenna Unit Test II questionsAntenna Unit Test II questions
Antenna Unit Test II questions
Gouthaman V
 
Combinational circuits II outputs
Combinational circuits II outputsCombinational circuits II outputs
Combinational circuits II outputs
Gouthaman V
 
Professional Ethics Assignment II
Professional Ethics Assignment IIProfessional Ethics Assignment II
Professional Ethics Assignment II
Gouthaman V
 
Scholastic averages sheet-2
Scholastic averages sheet-2Scholastic averages sheet-2
Scholastic averages sheet-2
Gouthaman V
 
Eligibility criteria and instructions for Infosys Placement
Eligibility criteria and instructions for Infosys PlacementEligibility criteria and instructions for Infosys Placement
Eligibility criteria and instructions for Infosys Placement
Gouthaman V
 
Answers for 2 Marks Unit Test I (RMW)
Answers for 2 Marks Unit Test I (RMW)Answers for 2 Marks Unit Test I (RMW)
Answers for 2 Marks Unit Test I (RMW)
Gouthaman V
 
Anwers for 2 marks - RMW
Anwers for 2 marks - RMWAnwers for 2 marks - RMW
Anwers for 2 marks - RMW
Gouthaman V
 
Rmw unit test question papers
Rmw unit test question papersRmw unit test question papers
Rmw unit test question papers
Gouthaman V
 
Circular and semicircular cavity resonator
Circular and semicircular cavity resonatorCircular and semicircular cavity resonator
Circular and semicircular cavity resonator
Gouthaman V
 
VLSI Anna University Practical Examination
VLSI Anna University Practical ExaminationVLSI Anna University Practical Examination
VLSI Anna University Practical Examination
Gouthaman V
 
VLSI Sequential Circuits II
VLSI Sequential Circuits IIVLSI Sequential Circuits II
VLSI Sequential Circuits II
Gouthaman V
 
VI Semester Examination Time Table
VI Semester Examination Time TableVI Semester Examination Time Table
VI Semester Examination Time Table
Gouthaman V
 
Antenna and Wave Propagation Assignment I
Antenna and Wave Propagation Assignment IAntenna and Wave Propagation Assignment I
Antenna and Wave Propagation Assignment I
Gouthaman V
 
Antenna and Wave Propagation Assignment I
Antenna and Wave Propagation Assignment IAntenna and Wave Propagation Assignment I
Antenna and Wave Propagation Assignment I
Gouthaman V
 
Computer Networks Unit Test II Questions
Computer Networks Unit Test II QuestionsComputer Networks Unit Test II Questions
Computer Networks Unit Test II Questions
Gouthaman V
 
Sequential Circuits I VLSI 9th experiment
Sequential Circuits I VLSI 9th experimentSequential Circuits I VLSI 9th experiment
Sequential Circuits I VLSI 9th experiment
Gouthaman V
 
Antenna Unit Test II Questions
Antenna Unit Test II QuestionsAntenna Unit Test II Questions
Antenna Unit Test II Questions
Gouthaman V
 
Antenna Unit Test II questions
Antenna Unit Test II questionsAntenna Unit Test II questions
Antenna Unit Test II questions
Gouthaman V
 
Combinational circuits II outputs
Combinational circuits II outputsCombinational circuits II outputs
Combinational circuits II outputs
Gouthaman V
 

Recently uploaded (20)

Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 

MySQL

  • 2. INTRODUCTION MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. The MySQL development project has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements. MySQL is owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, now owned by Sun Microsystems, a subsidiary of Oracle Corporation.
  • 3. Members of the MySQL community have created several forks such as Drizzle and MariaDB. Both forks were in progress before the Oracle acquisition (Drizzle was announced 8 months before the Sun acquisition). Free-software projects that require a full-featured database management system often use MySQL. Such projects include (for example) WordPress, phpBB, Drupal and other software built on the LAMP software stack. MySQL is also used in many high-profile, large-scale World Wide Web products including Wikipedia, Google and Facebook.
  • 5. Install MySQL 5.0 Community Edition on Windows Step 1 : Download MySQL 5.0 Community Edition to your Desktop from “http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.45-win32.zip/from/pick#mirrors”. Make sure you always download the “Complete package “.
  • 6. Step 2 : Unzip mysql-5.0.45-win32.zip (the downloaded mysql file) to get Setup.exe. Double click Setup.exe to start installing MySQL. Click “Next ” when you are prompted as below.
  • 7. Step 3 : Select “Typical” for Setup Type and click “Next ” again.
  • 8. Step 4 : Click “Install ” to proceed with the installation process.
  • 9. Step 5 : The setup activity will show you some advertisement. Read it if you wish and click “Next “.
  • 10. Step 6: Tick “Configure the MySQL Server now” and click “Next ” two times.
  • 11.  
  • 12. Step 7: Click “Standard Configuration” to ease installation process and click “Next ” again.
  • 13. Step 8 : Tick “Install As Windows Service” to make MySQL auto-startup with Windows and “Include Bin Directory in Windows PATH ” to make MySQL system files automatically available for other application.
  • 14. Step 9 : Tick “Modify Security Settings” and enter a root (Administrator) password to secure your MySQL installation. Don’t skip this step! Click “Next ” again.
  • 15. Step 10 : Click “Execute” to start the MySQL Configuration process. Once finished, click “Finish ” to end configuration.
  • 16.  
  • 17. Step 11: Make sure MySQL runs automatically after installation. You can check the status from Administrative Tools Services snap in (Start -> Programs -> Administrative Tools -> Services ), also available via Control Panel .
  • 18. Step 12 : (OPTIONAL) Open your DOS command prompt (Run -> cud). Type in “net stat -na“. Check out ports opened by MySQL (3306) and Apache (80) . That means the services are up and running.
  • 19. Step 13 : (OPTIONAL) Run some of MySQL commands to further ensure that the installation is a success. Check out and follow the commands as pictured below. User account is root and password depends on what you have entered previously during your MySQL configuration.
  • 20. Step 14 : IMPORTANT: Reboot your machine! This is to ensure all MySQL system files are rss-read by Windows as environment variables.
  • 21. QUERY COMMANDS IN MYSQL
  • 22. CREATE Command The Create command is used to create a table by specifying the tablename, fieldnames and constraints as shown below: Syntax: $createSQL=(&quot;CREATE TABLE tblName&quot;); Example: $createSQL=(&quot;CREATE TABLE tblstudent(fldstudid int(10) NOTNULL AUTO_INCREMENT PRIMARY KEY,fldstudName VARCHAR(250) NOTNULL,fldstudentmark int(4) DEFAULT '0' &quot;);
  • 23. SELECT Command The Select command is used to select the records from a table using its field names. To select all the fields in a table, '*' is used in the command. The result is assigned to a variable name as shown below: Syntax: $selectSQL=(&quot;SELECT field_names FROM tablename&quot;); Example: $selectSQL=(&quot;SELECT * FROM tblstudent&quot;);
  • 24. DELETE Command The Delete command is used to delete the records from a table using conditions as shown below: Syntax: $deleteSQL=(&quot;DELETE * FROM tablename WHERE condition&quot;); Example: $deleteSQL=(&quot;DELETE * FROM tblstudent WHERE fldstudid=2&quot;);
  • 25. INSERT Command The Insert command is used to insert records into a table. The values are assigned to the field names as shown below: Syntax: $insertSQL=(&quot;INSERT INTO tblname(fieldname1,fieldname2..) VALUES(value1,value2,...) &quot;); Example: $insertSQL=(&quot;INSERT INTO Tblstudent(fldstudName,fldstudmark)VALUES(Baskar,75) &quot;);
  • 26. UPDATE Command The Update command is used to update the field values using conditions. This is done using 'SET' and the fieldnames to assign new values to them. Syntax: $updateSQL=(&quot;UPDATE Tblname SET (fieldname1=value1,fieldname2=value2,...) WHERE fldstudid=IdNumber&quot;); Example: $updateSQL=(&quot;UPDATE Tblstudent SET (fldstudName=siva,fldstudmark=100) WHERE fldstudid=2&quot;);
  • 27. DROP Command The Drop command is used to delete all the records in a table using the table name as shown below: Syntax: $dropSQL=(&quot;DROP tblName&quot;); Example: $dropSQL=(&quot;DROP tblstudent&quot;);
  • 28. Login to MySQL monitor Syntax: ..\mysql\bin\mysql -u[username] -p[password] Example: ..\mysql\bin\mysql -uroot -pmysecret
  • 29. Create a database on the sql server. Syntax: CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name [create_specification] ... create_specification: [DEFAULT] CHARACTER SET [=] charset_name [DEFAULT] COLLATE [=] collation_name Example: u-1@srv-1 mysqlart $ mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 to server version: 4.0.14-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create database sysops; Query OK, 1 row affected (0.00 sec) mysql> quit Bye u-1@srv-1 mysqlart $
  • 30. Switch to a database. mysql> use [db name];
  • 31. mysql> show tables; To see all the tables in the database
  • 32. CREATE TABLE SYNTAX: CREATE TABLE [table_name] ( [column_name1] INT AUTO_INCREMENT, [column_name2] VARCHAR(30) NOT NULL, [column_name3] ENUM('guest', 'customer', 'admin')NULL, [column_name4] DATE NULL, [column_name5] VARCHAR(30) NOT NULL, [column_name6] DATETIME NOT NULL, [column_name7] CHAR(1) NULL, [column_name8] BLOB NULL, [column_name9] TEXT NOT NULL, UNIQUE(username), PRIMARY KEY (column_name1) Example: CREATE TABLE user ( userid INT AUTO_INCREMENT, username VARCHAR(30) NOT NULL, group_type ENUM('guest', 'customer', 'admin') NULL, date_of_birth DATE NULL, password VARCHAR(30) NOT NULL, registration_date DATETIME NOT NULL, account_disable CHAR(1) NULL, image BLOB NULL, comment TEXT NOT NULL, UNIQUE(username), PRIMARY KEY (userid) );
  • 33. INSERT STATEMENTS Syntax: INSERT INTO table_name ( `col_A`, `col_B`, `col_C`) VALUES ( `col_A_data`, `col_B_data`, `col_C_data`) ; Example: INSERT INTO music ( 'id', `artist`, `album`) VALUES ( '1', `the beatles`, `Abbey Road`);
  • 34. REPLACE STATEMENTS Syntax: REPLACE INTO table_name ( `col_A`, `col_B`) VALUES ( `col A data`, `col B data`) ; Example: REPLACE INTO music ( 'id', `artist`, `album`) VALUES ( '1', `the beatles`, `abbey road`);
  • 35. UPDATE STATEMENTS Syntax: UPDATE table_name SET col_B='new_data' WHERE col_A='reference_data' ; Example: UPDATE music SET title='Come Together' WHERE id=1;
  • 36. Add a new column &quot;male&quot; in table user. Syntax: ALTER TABLE [table_name] ADD COLUMN [column_name] CHAR(1) NOT NULL; Example: ALTER TABLE user ADD COLUMN male CHAR(1) NOT NULL;
  • 37. Change column name &quot;male&quot; into &quot;gender&quot; in table user and change the type to VARCHAR(3) and allow NULL values. Syntax: ALTER TABLE [table_name] CHANGE [old_column] [new_column] VARCHAR(3) NULL; Example: ALTER TABLE user CHANGE male gender VARCHAR (3) NULL;
  • 38. Change the size of column &quot;gender&quot; from 3 to 6 in table user. Syntax: ALTER TABLE [table_name] MODIFY [column_name] VARCHAR(6); Example: ALTER TABLE user MODIFY gender VARCHAR(6);
  • 39. SELECT STATEMENTS Syntax: SELECT * FROM table_name WHERE 1 ; Example: SELECT * FROM music WHERE 1;
  • 40. DELETE STATEMENTS Syntax: DELETE FROM table_name WHERE column_name='search_data'; Example: DELETE FROM music WHERE artist='the beatles';
  • 41. Show field formats of the selected table. Syntax: DESCRIBE [table_name]; Example: DESCRIBE mos_menu;
  • 42. To see database's field formats. mysql> describe [table name];
  • 43. To delete a database. Syntax: mysql> drop database [database name]; Example: DROP DATABASE demodb;
  • 44. To delete a table. mysql> drop table [table name]; Example: DROP TABLE user;
  • 45. Show all data in a table. mysql> SELECT * FROM [table name]; Example: SELECT * FROM mos_menu;
  • 46. Show all records from mos_menu table containing name &quot;Home&quot;. SELECT * FROM [table_name] WHERE [field_name]=[value]; Example: SELECT * FROM mos_menu WHERE name = &quot;Home&quot;;
  • 47. Returns the columns and column information pertaining to the designated table. mysql> show columns from [table name];
  • 48. Show certain selected rows with the value &quot;whatever&quot;. mysql> SELECT * FROM [table name] WHERE [field name] = &quot;whatever&quot;;
  • 49. Show all records containing the name &quot;Bob&quot; AND the phone number '3444444'. mysql> SELECT * FROM [table name] WHERE name = &quot;Bob&quot; AND phone_number = '3444444';
  • 50. Show all records not containing the name &quot;Bob&quot; AND the phone number '3444444' order by the phone_number field. mysql> SELECT * FROM [table name] WHERE name != &quot;Bob&quot; AND phone_number = '3444444' order by phone_number;
  • 51. Show all records starting with the letters 'bob' AND the phone number '3444444'. mysql> SELECT * FROM [table name] WHERE name like &quot;Bob%&quot; AND phone_number = '3444444';
  • 52. Show all records starting with the letters 'bob' AND the phone number '3444444' limit to records 1 through 5. mysql> SELECT * FROM [table name] WHERE name like &quot;Bob%&quot; AND phone_number = '3444444' limit 1,5;
  • 53. Use a regular expression to find records. Use &quot;REGEXP BINARY&quot; to force case-sensitivity. This finds any record beginning with a. mysql> SELECT * FROM [table name] WHERE rec RLIKE &quot;^a&quot;;
  • 54. Show unique records. mysql> SELECT DISTINCT [column name] FROM [table name];
  • 55. Show selected records sorted in an ascending (asc) or descending (desc). mysql> SELECT [col1],[col2] FROM [table name] ORDER BY [col2] DESC;
  • 56. Return number of rows. mysql> SELECT COUNT(*) FROM [table name];
  • 57. Sum column. mysql> SELECT SUM(*) FROM [table name];
  • 58. Join tables on common columns. mysql> select lookup.illustrationid, lookup.personid,person.birthday from lookup left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id;
  • 59. Creating a new user. Login as root. Switch to the MySQL db. Make the user. Update privs. # mysql -u root -p mysql> use mysql; mysql> INSERT INTO user (Host,User,Password) VALUES('%','username',PASSWORD('password')); mysql> flush privileges;
  • 60. Change a users password from unix shell. # [mysql dir]/bin/mysqladmin -u username -h hostname.blah.org -p password 'new-password'
  • 61. Change a users password from MySQL prompt. Login as root. Set the password. Update privs. # mysql -u root -p mysql> SET PASSWORD FOR 'user'@'hostname' = PASSWORD('passwordhere'); mysql> flush privileges;
  • 62. Recover a MySQL root password. Stop the MySQL server process. Start again with no grant tables. Login to MySQL as root. Set new password. Exit MySQL and restart MySQL server. # /etc/init.d/mysql stop # mysqld_safe --skip-grant-tables & # mysql -u root mysql> use mysql; mysql> update user set password=PASSWORD(&quot;newrootpassword&quot;) where User='root'; mysql> flush privileges; mysql> quit # /etc/init.d/mysql stop # /etc/init.d/mysql start
  • 63. Set a root password if there is on root password. # mysqladmin -u root password newpassword
  • 64. Update a root password. # mysqladmin -u root -p oldpassword newpassword
  • 65. Allow the user &quot;bob&quot; to connect to the server from localhost using the password &quot;passwd&quot;. Login as root. Switch to the MySQL db. Give privs. Update privs. # mysql -u root -p mysql> use mysql; mysql> grant usage on *.* to bob@localhost identified by 'passwd'; mysql> flush privileges;
  • 66. Give user privilages for a db. Login as root. Switch to the MySQL db. Grant privs. Update privs. # mysql -u root -p mysql> use mysql; mysql> INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES ('%','databasename','username','Y','Y','Y','Y','Y','N'); mysql> flush privileges; or mysql> grant all privileges on databasename.* to username@localhost; mysql> flush privileges;
  • 67. To update info already in a table. mysql> UPDATE [table name] SET Select_priv = 'Y',Insert_priv = 'Y',Update_priv = 'Y' where [field name] = 'user';
  • 68. Delete a row(s) from a table. mysql> DELETE from [table name] where [field name] = 'whatever';
  • 69. Update database permissions/privilages. mysql> flush privileges;
  • 70. Delete a column. mysql> alter table [table name] drop column [column name];
  • 71. Add a new column to database. mysql> alter table [table name] add column [new column name] varchar (20);
  • 72. Change column name. mysql> alter table [table name] change [old column name] [new column name] varchar (50);
  • 73. Make a unique column so you get no dupes. mysql> alter table [table name] add unique ([column name]);
  • 74. Make a column bigger. mysql> alter table [table name] modify [column name] VARCHAR(3);
  • 75. Delete unique from table. mysql> alter table [table name] drop index [colmn name];
  • 76. Load a CSV file into a table. mysql> LOAD DATA INFILE '/tmp/filename.csv' replace INTO TABLE [table name] FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (field1,field2,field3);
  • 77. Dump all databases for backup. Backup file is sql commands to recreate all db's. # [mysql dir]/bin/mysqldump -u root -ppassword --opt >/tmp/alldatabases.sql
  • 78. Dump one database for backup. # [mysql dir]/bin/mysqldump -u username -ppassword --databases databasename >/tmp/databasename.sql
  • 79. Dump a table from a database. # [mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql
  • 80. Restore database (or database table) from backup. # [mysql dir]/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql
  • 81.