SlideShare a Scribd company logo
1 of 20
MySQL Database Creation
• D:>cd wampbinmysqlmysql5.6.12bin
• D:> cd XAMPPmysqlbin
Creating Database
• Before doing anything else with the data in
MySQL, you need to create a database. A
database is a container of data.
• It stores contacts, vendors, customers, students,
colleges or any kind of data that you can think of.
• In MySQL, a database is a collection of objects
that are used to store and manipulate data such
as tables, database views, triggers, stored
procedures, etc.
To create a database in MySQL
• CREATE DATABASE [IF NOT
EXISTS]database_name;
• Example:
• CREATE DATABASE student;
Before start the XAMPP Server
Displaying Databases
• The SHOW DATABASE statement displays all
databases in the MySQL database server.
Example:
Mysql>SHOW DATABASES;
Selecting a database to work with
• Before working with a particular database, you
must tell MySQL which database you want to
work with by using the USE statement.
• Example:
Mysql>USE database_name;
Mysql>Use Student;
• NOTE:
• From now all operations such as querying data,
create new tables or stored procedures which
you perform, will take effects on the current
Removing Databases
• Removing database means you delete the
database physically. All the data and related
objects inside the database are permanently
deleted and this cannot be undone, therefore it is
very important to execute this query with extra
cautions.
• Example:
Mysql>DROP DATABASE database_name;
CREATE USER ACCOUNT:
• Mysql>create user (newuser_name)@localhost
identified by ‘password’;
• Example:
• Mysql> create user siddiq@localhost identified by
'123';
• Query OK, 0 rows affected (0.02 sec)
Create a User Account
• Mysql>GRANT ALL ON database_name.* To
user_name@localhost IDENTIFIED by ‘Password’;
• mysql> GRANT ALL ON sample.* TO
sps@localhost IDENTIFIED BY 'mypassword';
Note:
• GRANT ALL means all privileges i.e. user is
permitted do anything. She/he can read, modify
or delete data, but only on tables in the demo
database. She/he cannot access any other
database.
How do I connect to MySQL server using
user1 account?• User SPS can connect to mysql server SAMPLE database
using following command:
• $ mysql –u sps –p
(OR)
• $ mysql –u sps -h mysql.server.com -p demo
Where,
• -u user1: MySQL Username
• -h : MySQL server name (default is localhost)
• -p : Prompt for password
• demo: demo is name of mysql database (optional)
Resetting the Root/User Password:
• Update mysql.user SET Password= ‘new
password’ Where User = ‘User_name’;
• Flush PRIVILEGES;
• Write the UPDATE and FLUSH statements each
on a single line. The UPDATE statement resets
the password for allroot accounts, and
the FLUSH statement tells the server to reload
the grant tables into memory so that it notices
the password change
Revoke
• The REVOKE statement enables system
administrators to revoke privileges from MySQL
accounts.
• REVOKE priv_type [(column_list)] [, priv_type
[(column_list)]] ... ON priv_level FROM user [,
user] ...
• REVOKE ALL PRIVILEGES, GRANT OPTION FROM
user [, user] ...
• mysql> revoke delete on college.*
• -> from staff@localhost;
• Query OK, 0 rows affected (0.00 sec)
•
• mysql> revoke all on college.*
• -> from staff@localhost;
• Query OK, 0 rows affected (0.00 sec)

More Related Content

What's hot

SQL Server Integration Services Tips & Tricks
SQL Server Integration Services Tips & TricksSQL Server Integration Services Tips & Tricks
SQL Server Integration Services Tips & Tricks
Guillermo Caicedo
 
Visualizing a Database Structure with SchemaSpy
Visualizing a Database Structure with SchemaSpyVisualizing a Database Structure with SchemaSpy
Visualizing a Database Structure with SchemaSpy
Guo Albert
 

What's hot (20)

SQL Server Integration Services Tips & Tricks
SQL Server Integration Services Tips & TricksSQL Server Integration Services Tips & Tricks
SQL Server Integration Services Tips & Tricks
 
Android Level 2
Android Level 2Android Level 2
Android Level 2
 
Evolution of MongoDB Replicaset and Its Best Practices
Evolution of MongoDB Replicaset and Its Best PracticesEvolution of MongoDB Replicaset and Its Best Practices
Evolution of MongoDB Replicaset and Its Best Practices
 
Visualizing a Database Structure with SchemaSpy
Visualizing a Database Structure with SchemaSpyVisualizing a Database Structure with SchemaSpy
Visualizing a Database Structure with SchemaSpy
 
Postgres connections at scale
Postgres connections at scalePostgres connections at scale
Postgres connections at scale
 
MySQL training in Bangalore | Best MySQL Course in Bangalore
MySQL training in Bangalore | Best MySQL Course in BangaloreMySQL training in Bangalore | Best MySQL Course in Bangalore
MySQL training in Bangalore | Best MySQL Course in Bangalore
 
Play 2.0
Play 2.0Play 2.0
Play 2.0
 
Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)
 
Drupal feature proposal: two new stream-wrappers
Drupal feature proposal: two new stream-wrappersDrupal feature proposal: two new stream-wrappers
Drupal feature proposal: two new stream-wrappers
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedure
 
MySQL Performance Schema in Action
MySQL Performance Schema in Action MySQL Performance Schema in Action
MySQL Performance Schema in Action
 
Introduction to AJAX
Introduction to AJAXIntroduction to AJAX
Introduction to AJAX
 
Sqlite
SqliteSqlite
Sqlite
 
MuleSoft ESB Scripting Example
MuleSoft ESB Scripting ExampleMuleSoft ESB Scripting Example
MuleSoft ESB Scripting Example
 
Supercharging MySQL and MariaDB with Plug-ins (SCaLE 12x)
Supercharging MySQL and MariaDB with Plug-ins (SCaLE 12x)Supercharging MySQL and MariaDB with Plug-ins (SCaLE 12x)
Supercharging MySQL and MariaDB with Plug-ins (SCaLE 12x)
 
Lecture12
Lecture12Lecture12
Lecture12
 
MongoDB London PHP
MongoDB London PHPMongoDB London PHP
MongoDB London PHP
 
Query handlingbytheserver
Query handlingbytheserverQuery handlingbytheserver
Query handlingbytheserver
 
Hadoop spark online demo
Hadoop spark online demoHadoop spark online demo
Hadoop spark online demo
 
How to Play at Work - A Play Framework Tutorial
How to Play at Work - A Play Framework TutorialHow to Play at Work - A Play Framework Tutorial
How to Play at Work - A Play Framework Tutorial
 

Viewers also liked

Viewers also liked (6)

Osi model 7 Layers
Osi model 7 LayersOsi model 7 Layers
Osi model 7 Layers
 
Micro programmed control
Micro programmed controlMicro programmed control
Micro programmed control
 
Basic networking
Basic networkingBasic networking
Basic networking
 
Datapath Design of Computer Architecture
Datapath Design of Computer ArchitectureDatapath Design of Computer Architecture
Datapath Design of Computer Architecture
 
Micro programmed control
Micro programmed controlMicro programmed control
Micro programmed control
 
Hardwired control
Hardwired controlHardwired control
Hardwired control
 

Similar to Mysql grand

xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
WrushabhShirsat3
 
My sql technical reference manual
My sql technical reference manualMy sql technical reference manual
My sql technical reference manual
Mir Majid
 
All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restore
Vasudeva Rao
 
Based on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docxBased on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docx
JASS44
 

Similar to Mysql grand (20)

unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
 
MySQL for beginners
MySQL for beginnersMySQL for beginners
MySQL for beginners
 
PHP and MySQL.pptx
PHP and MySQL.pptxPHP and MySQL.pptx
PHP and MySQL.pptx
 
Sah
SahSah
Sah
 
My sql technical reference manual
My sql technical reference manualMy sql technical reference manual
My sql technical reference manual
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
 
Using Mysql.pptx
Using Mysql.pptxUsing Mysql.pptx
Using Mysql.pptx
 
Mysql ppt
Mysql pptMysql ppt
Mysql ppt
 
My sql administration
My sql administrationMy sql administration
My sql administration
 
create database.pptx
create database.pptxcreate database.pptx
create database.pptx
 
MySQL with PHP
MySQL with PHPMySQL with PHP
MySQL with PHP
 
SQL Fundamentals - Lecture 2
SQL Fundamentals - Lecture 2SQL Fundamentals - Lecture 2
SQL Fundamentals - Lecture 2
 
Database Connectivity in PHP
Database Connectivity in PHPDatabase Connectivity in PHP
Database Connectivity in PHP
 
Mysql tutorial 5257
Mysql tutorial 5257Mysql tutorial 5257
Mysql tutorial 5257
 
All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restore
 
Based on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docxBased on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docx
 
Mysql all
Mysql allMysql all
Mysql all
 
BITS: Introduction to MySQL - Introduction and Installation
BITS: Introduction to MySQL - Introduction and InstallationBITS: Introduction to MySQL - Introduction and Installation
BITS: Introduction to MySQL - Introduction and Installation
 
Mysql tutorial
Mysql tutorialMysql tutorial
Mysql tutorial
 

More from Siddique Ibrahim

Php hypertext pre-processor
Php   hypertext pre-processorPhp   hypertext pre-processor
Php hypertext pre-processor
Siddique Ibrahim
 

More from Siddique Ibrahim (20)

List in Python
List in PythonList in Python
List in Python
 
Python Control structures
Python Control structuresPython Control structures
Python Control structures
 
Python programming introduction
Python programming introductionPython programming introduction
Python programming introduction
 
Data mining basic fundamentals
Data mining basic fundamentalsData mining basic fundamentals
Data mining basic fundamentals
 
Virtualization Concepts
Virtualization ConceptsVirtualization Concepts
Virtualization Concepts
 
Networking devices(siddique)
Networking devices(siddique)Networking devices(siddique)
Networking devices(siddique)
 
pipelining
pipeliningpipelining
pipelining
 
interface
interfaceinterface
interface
 
Interrupt
InterruptInterrupt
Interrupt
 
Interrupt
InterruptInterrupt
Interrupt
 
DMA
DMADMA
DMA
 
Io devies
Io deviesIo devies
Io devies
 
Stack & queue
Stack & queueStack & queue
Stack & queue
 
Metadata in data warehouse
Metadata in data warehouseMetadata in data warehouse
Metadata in data warehouse
 
Data extraction, transformation, and loading
Data extraction, transformation, and loadingData extraction, transformation, and loading
Data extraction, transformation, and loading
 
Aggregate fact tables
Aggregate fact tablesAggregate fact tables
Aggregate fact tables
 
PHP variables
PHP  variablesPHP  variables
PHP variables
 
Php hypertext pre-processor
Php   hypertext pre-processorPhp   hypertext pre-processor
Php hypertext pre-processor
 
Cryptography basices
Cryptography basicesCryptography basices
Cryptography basices
 
Secondary storage devices
Secondary storage devicesSecondary storage devices
Secondary storage devices
 

Recently uploaded

Recently uploaded (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Mysql grand

  • 3. Creating Database • Before doing anything else with the data in MySQL, you need to create a database. A database is a container of data. • It stores contacts, vendors, customers, students, colleges or any kind of data that you can think of. • In MySQL, a database is a collection of objects that are used to store and manipulate data such as tables, database views, triggers, stored procedures, etc.
  • 4. To create a database in MySQL • CREATE DATABASE [IF NOT EXISTS]database_name; • Example: • CREATE DATABASE student;
  • 5. Before start the XAMPP Server
  • 6. Displaying Databases • The SHOW DATABASE statement displays all databases in the MySQL database server. Example: Mysql>SHOW DATABASES;
  • 7. Selecting a database to work with • Before working with a particular database, you must tell MySQL which database you want to work with by using the USE statement. • Example: Mysql>USE database_name; Mysql>Use Student; • NOTE: • From now all operations such as querying data, create new tables or stored procedures which you perform, will take effects on the current
  • 8.
  • 9. Removing Databases • Removing database means you delete the database physically. All the data and related objects inside the database are permanently deleted and this cannot be undone, therefore it is very important to execute this query with extra cautions. • Example: Mysql>DROP DATABASE database_name;
  • 10.
  • 11. CREATE USER ACCOUNT: • Mysql>create user (newuser_name)@localhost identified by ‘password’; • Example: • Mysql> create user siddiq@localhost identified by '123'; • Query OK, 0 rows affected (0.02 sec)
  • 12.
  • 13. Create a User Account • Mysql>GRANT ALL ON database_name.* To user_name@localhost IDENTIFIED by ‘Password’; • mysql> GRANT ALL ON sample.* TO sps@localhost IDENTIFIED BY 'mypassword'; Note: • GRANT ALL means all privileges i.e. user is permitted do anything. She/he can read, modify or delete data, but only on tables in the demo database. She/he cannot access any other database.
  • 14.
  • 15. How do I connect to MySQL server using user1 account?• User SPS can connect to mysql server SAMPLE database using following command: • $ mysql –u sps –p (OR) • $ mysql –u sps -h mysql.server.com -p demo Where, • -u user1: MySQL Username • -h : MySQL server name (default is localhost) • -p : Prompt for password • demo: demo is name of mysql database (optional)
  • 16.
  • 17.
  • 18. Resetting the Root/User Password: • Update mysql.user SET Password= ‘new password’ Where User = ‘User_name’; • Flush PRIVILEGES; • Write the UPDATE and FLUSH statements each on a single line. The UPDATE statement resets the password for allroot accounts, and the FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change
  • 19. Revoke • The REVOKE statement enables system administrators to revoke privileges from MySQL accounts. • REVOKE priv_type [(column_list)] [, priv_type [(column_list)]] ... ON priv_level FROM user [, user] ... • REVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...
  • 20. • mysql> revoke delete on college.* • -> from staff@localhost; • Query OK, 0 rows affected (0.00 sec) • • mysql> revoke all on college.* • -> from staff@localhost; • Query OK, 0 rows affected (0.00 sec)