SlideShare a Scribd company logo
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
Mysql grand
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;
Mysql grand
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)
Mysql grand
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.
Mysql grand
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)
Mysql grand
Mysql grand
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

PPT
Getting started into mySQL
PPTX
Php basics
PDF
working with database using mysql
PPT
Wordpress install setup
PPTX
Insight on MongoDB Change Stream - Abhishek.D, Mydbops Team
PDF
MySQL Rebuild using Logical Backups
PPS
Linux17 MySQL_installation
PPTX
MySQL Record Operations
Getting started into mySQL
Php basics
working with database using mysql
Wordpress install setup
Insight on MongoDB Change Stream - Abhishek.D, Mydbops Team
MySQL Rebuild using Logical Backups
Linux17 MySQL_installation
MySQL Record Operations

What's hot (20)

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

Viewers also liked (6)

PPT
Osi model 7 Layers
PPT
Micro programmed control
PPT
Basic networking
PPTX
Datapath Design of Computer Architecture
PPT
Micro programmed control
PPTX
Hardwired control
Osi model 7 Layers
Micro programmed control
Basic networking
Datapath Design of Computer Architecture
Micro programmed control
Hardwired control
Ad

Similar to Mysql grand (20)

PPTX
unit-ii.pptx
PPTX
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
PPTX
NCTU ppt 2023-2024_WEEK2-SQL Basics (1).pptx
PPTX
3-Chapter-Edit.pptx debre tabour university
PDF
MySQL for beginners
PPTX
PHP and MySQL.pptx
DOC
My sql technical reference manual
PPT
MYSQL - PHP Database Connectivity
PPTX
Using Mysql.pptx
PPT
Mysql ppt
PPTX
My sql administration
PPTX
create database.pptx
PPTX
MySQL with PHP
PDF
SQL Fundamentals - Lecture 2
PDF
NCTU ppt 2023-2024_WEEK2-SQL Basics (1) (1).pdf
PPTX
Database Connectivity in PHP
PDF
Mysql tutorial 5257
DOCX
All types of backups and restore
DOCX
Based on the materials for this week, create your own unique Datab.docx
unit-ii.pptx
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
NCTU ppt 2023-2024_WEEK2-SQL Basics (1).pptx
3-Chapter-Edit.pptx debre tabour university
MySQL for beginners
PHP and MySQL.pptx
My sql technical reference manual
MYSQL - PHP Database Connectivity
Using Mysql.pptx
Mysql ppt
My sql administration
create database.pptx
MySQL with PHP
SQL Fundamentals - Lecture 2
NCTU ppt 2023-2024_WEEK2-SQL Basics (1) (1).pdf
Database Connectivity in PHP
Mysql tutorial 5257
All types of backups and restore
Based on the materials for this week, create your own unique Datab.docx

More from Siddique Ibrahim (20)

PPTX
List in Python
PPT
Python Control structures
PPTX
Python programming introduction
PPT
Data mining basic fundamentals
PPT
Virtualization Concepts
PPT
Networking devices(siddique)
PPT
pipelining
PPT
interface
PPT
Interrupt
PPT
Interrupt
PPT
Io devies
PPT
Stack & queue
PPT
Metadata in data warehouse
PPTX
Data extraction, transformation, and loading
PPT
Aggregate fact tables
PPT
PHP variables
PPT
Php hypertext pre-processor
PPT
Cryptography basices
PPT
Secondary storage devices
List in Python
Python Control structures
Python programming introduction
Data mining basic fundamentals
Virtualization Concepts
Networking devices(siddique)
pipelining
interface
Interrupt
Interrupt
Io devies
Stack & queue
Metadata in data warehouse
Data extraction, transformation, and loading
Aggregate fact tables
PHP variables
Php hypertext pre-processor
Cryptography basices
Secondary storage devices

Recently uploaded (20)

PPTX
Machine Learning_overview_presentation.pptx
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
A comparative analysis of optical character recognition models for extracting...
PPT
Teaching material agriculture food technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Approach and Philosophy of On baking technology
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Electronic commerce courselecture one. Pdf
PPTX
1. Introduction to Computer Programming.pptx
PDF
Getting Started with Data Integration: FME Form 101
Machine Learning_overview_presentation.pptx
Machine learning based COVID-19 study performance prediction
Digital-Transformation-Roadmap-for-Companies.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
A comparative analysis of optical character recognition models for extracting...
Teaching material agriculture food technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Per capita expenditure prediction using model stacking based on satellite ima...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
NewMind AI Weekly Chronicles - August'25-Week II
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Assigned Numbers - 2025 - Bluetooth® Document
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Approach and Philosophy of On baking technology
SOPHOS-XG Firewall Administrator PPT.pptx
Electronic commerce courselecture one. Pdf
1. Introduction to Computer Programming.pptx
Getting Started with Data Integration: FME Form 101

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
  • 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;
  • 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)
  • 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.
  • 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)
  • 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)