SlideShare a Scribd company logo
Mohd Yasin Abd Karim
yasin@teras-solution.com
   Configuring
   Monitoring, Starting & Stopping
   Managing Users and Connection
   Performing backups
   Others
   Mysqladmin or mysql
   GUI
    ◦ MySQL Administrator
    ◦ MySQL Workbench
    ◦ phpMyAdmin
   OS packages place files in many areas and
    varies
    ◦ e.g. /usr/lib, /var/lib, /var/log, /etc
   Source rpm, yum, .tar.gz, exe
   Online/repo update
    ◦ #yum update mysql-*
   For Ms Windows Environment
    C:>cd localmysqlbin
    C:localmysqlbin>

Local folder normally Program Files folder
   Start MySQL process before create database
   To configure MySQL start at boot time
         #chkconfig mysqld on


   Or using GUI tools such as OS Services
    Management
   After boot time using the services commands

      #service mysqld start
      #service mysqld stop
      #Service mysqld restart

   Remember to restart mysqld process every
    time after configuration changed
   to know whether your MySQL server is alive

       #pgrep mysqld


   Should get response process ID numbers
   Or
       #mysqladmin –u root –p ping

   The "mysqld is alive" message tells you that
    your MySQL server is running ok. If your
    MySQL server is not running, you will get a
    "connect ... failed" message.
   my.cnf
    ◦ Watch out for /etc/my.cnf, /etc/mysql/my.cnf
   To get the server listening on all
    interfaces, use 0.0.0.0 as the bind address.
    i.e.:
    --bind-address=0.0.0.0
   Configured to listen TCP/IP Port (default
    3306)
   Additional Instances
    ◦ Different Ports
    ◦ Different IP‟s using default Port
   Local connection using Socket
   Login to MySQL server
       #mysql –h hostname –u root -p


   Create a database
       msql> create database [databasename];


   List all databases on the MySQL server
       msql> show databases;
   Swicth to a database

       msql> use [db_name];


   To see all the tables in the db
       msql> show tables;


   To delete a db
       msql> drop database [databasename];
   To see database‟s field formats
       msql> describe [table name];


   To delete a table
       msql> drop table [table name];


   Show all data in a table

       msql> SELECT * FROM [table name];
   SHOW   TABLES;
   SHOW   WARNINGS;
   SHOW   STATUS; FLUSH STATUS;
   SHOW   VARIABLES;
   SHOW   VARIABLES LIKE „%size%‟;
   SHOW   VARIABLES LIKE „sort_buffer_size‟;
   SHOW   GLOBAL STATUS;
   to check version number of your MySQL
    server

     C:localmysqlbin>mysqladmin -u root version
   According to the /etc/my.cnf
   Usually located in subdirectory
    /var/lib/mysql/ directory
   Example : test database
    ◦ /var/lib/mysql/test
   Root or superuser account is used to create
    and delete database
   New installation MySQL set password

      #mysqladmin –u root password new-password
   to know what else you can do with
    "mysqladmin", you should run the "-?"

     #mysqladmin –?
   Creating new user

     # mysql -u root -p
     mysql> use mysql;
     mysql> INSERT INTO user (Host,User,Password)
     VALUES('%','username',PASSWORD('password'));
     mysql> flush privileges;
   Change a user password from unix shell

     # mysqladmin -u username -h hostname.org -p password
     'new-password'


   Change user password from MySQL prompt
     # mysql -u root -p
     mysql> SET PASSWORD FOR 'user'@'hostname' =
     PASSWORD('passwordhere');
     mysql> flush privileges;
   Update root password

     # mysqladmin -u root -p oldpassword newpassword


   Allow the user “bob” to connect to server
    from localhost using password „passwd‟
     # mysql -u root -p
     mysql> use mysql;
     mysql> grant usage on *.* to bob@localhost identified by
     'passwd';
     mysql> flush privileges;
   Give user privileges for a db.

     # 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 table

     mysql> UPDATE [table name] SET Select_priv = 'Y',Insert_priv
     = 'Y',Update_priv = 'Y' where [field name] = 'user';


   Delete a rows from table
     mysql> DELETE from [table name] where [field name] =
     'whatever';

   Update database permissions/privileges
     mysql> flush privileges;
   Dump all databases for backup
    # mysqldump -u root -ppassword --opt >/tmp/alldatabases.sql


   Dump one database for backup
    # mysqldump -u username -ppassword --databases
    databasename >/tmp/databasename.sql


   Dump a table from a database
    # mysqldump -c -u username -ppassword databasename
    tablename > /tmp/databasename.tablename.sql
   Restore database / table from backup
    # mysql -u username -ppassword databasename <
    /tmp/databasename.sql
   Example
    mysql> create table [table name] (personid int(50) not null
    auto_increment primary key,firstname varchar(35),middlename
    varchar(50),lastnamevarchar(50) default „yasin');


    mysql> CREATE TABLE [table name] (firstname
    VARCHAR(20), middleinitial VARCHAR(3), lastname
    VARCHAR(35),suffix VARCHAR(3),officeid VARCHAR(10),userid
    VARCHAR(15),username VARCHAR(8),email VARCHAR(35),phone
    VARCHAR(25), groups VARCHAR(15),datestamp DATE,timestamp
    time,pgpemail VARCHAR(255));
   yasin@teras-solution.com

More Related Content

What's hot

Troubleshooting MySQL Performance
Troubleshooting MySQL PerformanceTroubleshooting MySQL Performance
Troubleshooting MySQL Performance
Sveta Smirnova
 
MySQL database replication
MySQL database replicationMySQL database replication
MySQL database replication
PoguttuezhiniVP
 
My SQL 101
My SQL 101My SQL 101
My SQL 101
Dave Stokes
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf TuningHighLoad2009
 
Mysql all
Mysql allMysql all
ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)
YoungHeon (Roy) Kim
 
Database Connection With Mysql
Database Connection With MysqlDatabase Connection With Mysql
Database Connection With MysqlHarit Kothari
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in Action
Sveta Smirnova
 
Mysql database basic user guide
Mysql database basic user guideMysql database basic user guide
Mysql database basic user guide
PoguttuezhiniVP
 
A brief introduction to PostgreSQL
A brief introduction to PostgreSQLA brief introduction to PostgreSQL
A brief introduction to PostgreSQL
Vu Hung Nguyen
 
Percona Toolkit for Effective MySQL Administration
Percona Toolkit for Effective MySQL AdministrationPercona Toolkit for Effective MySQL Administration
Percona Toolkit for Effective MySQL Administration
Mydbops
 
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sadDevelopers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
mCloud
 
Introduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterIntroduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB Cluster
I Goo Lee
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
Wim Godden
 
Memcached Presentation @757rb
Memcached Presentation @757rbMemcached Presentation @757rb
Memcached Presentation @757rbKen Collins
 
15 MySQL Basics #burningkeyboards
15 MySQL Basics #burningkeyboards15 MySQL Basics #burningkeyboards
15 MySQL Basics #burningkeyboards
Denis Ristic
 
Capturing, Analyzing, and Optimizing your SQL
Capturing, Analyzing, and Optimizing your SQLCapturing, Analyzing, and Optimizing your SQL
Capturing, Analyzing, and Optimizing your SQLPadraig O'Sullivan
 
MariaDB Optimizer
MariaDB OptimizerMariaDB Optimizer
MariaDB Optimizer
JongJin Lee
 
Top Node.js Metrics to Watch
Top Node.js Metrics to WatchTop Node.js Metrics to Watch
Top Node.js Metrics to Watch
Sematext Group, Inc.
 
Mater,slave on mysql
Mater,slave on mysqlMater,slave on mysql
Mater,slave on mysqlVasudeva Rao
 

What's hot (20)

Troubleshooting MySQL Performance
Troubleshooting MySQL PerformanceTroubleshooting MySQL Performance
Troubleshooting MySQL Performance
 
MySQL database replication
MySQL database replicationMySQL database replication
MySQL database replication
 
My SQL 101
My SQL 101My SQL 101
My SQL 101
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf Tuning
 
Mysql all
Mysql allMysql all
Mysql all
 
ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)
 
Database Connection With Mysql
Database Connection With MysqlDatabase Connection With Mysql
Database Connection With Mysql
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in Action
 
Mysql database basic user guide
Mysql database basic user guideMysql database basic user guide
Mysql database basic user guide
 
A brief introduction to PostgreSQL
A brief introduction to PostgreSQLA brief introduction to PostgreSQL
A brief introduction to PostgreSQL
 
Percona Toolkit for Effective MySQL Administration
Percona Toolkit for Effective MySQL AdministrationPercona Toolkit for Effective MySQL Administration
Percona Toolkit for Effective MySQL Administration
 
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sadDevelopers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
 
Introduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterIntroduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB Cluster
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Memcached Presentation @757rb
Memcached Presentation @757rbMemcached Presentation @757rb
Memcached Presentation @757rb
 
15 MySQL Basics #burningkeyboards
15 MySQL Basics #burningkeyboards15 MySQL Basics #burningkeyboards
15 MySQL Basics #burningkeyboards
 
Capturing, Analyzing, and Optimizing your SQL
Capturing, Analyzing, and Optimizing your SQLCapturing, Analyzing, and Optimizing your SQL
Capturing, Analyzing, and Optimizing your SQL
 
MariaDB Optimizer
MariaDB OptimizerMariaDB Optimizer
MariaDB Optimizer
 
Top Node.js Metrics to Watch
Top Node.js Metrics to WatchTop Node.js Metrics to Watch
Top Node.js Metrics to Watch
 
Mater,slave on mysql
Mater,slave on mysqlMater,slave on mysql
Mater,slave on mysql
 

Viewers also liked

openark-kit: MySQL utilities for everyday use
openark-kit: MySQL utilities for everyday useopenark-kit: MySQL utilities for everyday use
openark-kit: MySQL utilities for everyday use
Shlomi Noach
 
common_schema 2.0: DBA's Framework for MySQL
common_schema 2.0: DBA's Framework for MySQLcommon_schema 2.0: DBA's Framework for MySQL
common_schema 2.0: DBA's Framework for MySQL
Shlomi Noach
 
MySQL DevOps at Outbrain
MySQL DevOps at OutbrainMySQL DevOps at Outbrain
MySQL DevOps at Outbrain
Shlomi Noach
 
Pseudo gtid & easy replication topology management
Pseudo gtid & easy replication topology managementPseudo gtid & easy replication topology management
Pseudo gtid & easy replication topology management
Shlomi Noach
 
Managing and Visualizing your Replication Topologies with Orchestrator
Managing and Visualizing your Replication Topologies with OrchestratorManaging and Visualizing your Replication Topologies with Orchestrator
Managing and Visualizing your Replication Topologies with Orchestrator
Shlomi Noach
 
Pseudo GTID and Easy MySQL Replication Topology Management
Pseudo GTID and Easy MySQL Replication Topology ManagementPseudo GTID and Easy MySQL Replication Topology Management
Pseudo GTID and Easy MySQL Replication Topology Management
Shlomi Noach
 

Viewers also liked (6)

openark-kit: MySQL utilities for everyday use
openark-kit: MySQL utilities for everyday useopenark-kit: MySQL utilities for everyday use
openark-kit: MySQL utilities for everyday use
 
common_schema 2.0: DBA's Framework for MySQL
common_schema 2.0: DBA's Framework for MySQLcommon_schema 2.0: DBA's Framework for MySQL
common_schema 2.0: DBA's Framework for MySQL
 
MySQL DevOps at Outbrain
MySQL DevOps at OutbrainMySQL DevOps at Outbrain
MySQL DevOps at Outbrain
 
Pseudo gtid & easy replication topology management
Pseudo gtid & easy replication topology managementPseudo gtid & easy replication topology management
Pseudo gtid & easy replication topology management
 
Managing and Visualizing your Replication Topologies with Orchestrator
Managing and Visualizing your Replication Topologies with OrchestratorManaging and Visualizing your Replication Topologies with Orchestrator
Managing and Visualizing your Replication Topologies with Orchestrator
 
Pseudo GTID and Easy MySQL Replication Topology Management
Pseudo GTID and Easy MySQL Replication Topology ManagementPseudo GTID and Easy MySQL Replication Topology Management
Pseudo GTID and Easy MySQL Replication Topology Management
 

Similar to My sql administration

Mysql administration
Mysql administrationMysql administration
Mysql administration
beben benzy
 
MySQL DBA OCP 1Z0-883
MySQL DBA OCP 1Z0-883MySQL DBA OCP 1Z0-883
MySQL DBA OCP 1Z0-883
Kwaye Kant
 
Multiple instances second method
Multiple instances second methodMultiple instances second method
Multiple instances second method
Vasudeva Rao
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
Mark Leith
 
Chef solo the beginning
Chef solo the beginning Chef solo the beginning
Chef solo the beginning
A.K.M. Ahsrafuzzaman
 
Multiple instances on linux
Multiple instances on linuxMultiple instances on linux
Multiple instances on linux
Vasudeva Rao
 
Distribuido
DistribuidoDistribuido
Distribuido
Jose Rojas
 
My two cents about Mysql backup
My two cents about Mysql backupMy two cents about Mysql backup
My two cents about Mysql backup
Andrejs Vorobjovs
 
MySql cheat sheet
MySql cheat sheetMySql cheat sheet
MySql cheat sheet
Lam Hoang
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
Tahsin Hasan
 
Multiple instance on windows
Multiple instance on windowsMultiple instance on windows
Multiple instance on windows
Vasudeva Rao
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
Federico Razzoli
 
Passwordless login with unix auth_socket
Passwordless login with unix auth_socketPasswordless login with unix auth_socket
Passwordless login with unix auth_socket
Otto Kekäläinen
 
Mysql
Mysql Mysql
Mysql
Mindtree
 
TrinityCore server install guide
TrinityCore server install guideTrinityCore server install guide
TrinityCore server install guide
Seungmin Shin
 
Intalacion de owncloud
Intalacion de owncloudIntalacion de owncloud
Intalacion de owncloud
Fredy Ntn Bautista
 
Service discovery and configuration provisioning
Service discovery and configuration provisioningService discovery and configuration provisioning
Service discovery and configuration provisioning
Source Ministry
 

Similar to My sql administration (20)

Mysql administration
Mysql administrationMysql administration
Mysql administration
 
Sah
SahSah
Sah
 
MySQL DBA OCP 1Z0-883
MySQL DBA OCP 1Z0-883MySQL DBA OCP 1Z0-883
MySQL DBA OCP 1Z0-883
 
Mysql all
Mysql allMysql all
Mysql all
 
Multiple instances second method
Multiple instances second methodMultiple instances second method
Multiple instances second method
 
Raj mysql
Raj mysqlRaj mysql
Raj mysql
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Chef solo the beginning
Chef solo the beginning Chef solo the beginning
Chef solo the beginning
 
Multiple instances on linux
Multiple instances on linuxMultiple instances on linux
Multiple instances on linux
 
Distribuido
DistribuidoDistribuido
Distribuido
 
My two cents about Mysql backup
My two cents about Mysql backupMy two cents about Mysql backup
My two cents about Mysql backup
 
MySql cheat sheet
MySql cheat sheetMySql cheat sheet
MySql cheat sheet
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
 
Multiple instance on windows
Multiple instance on windowsMultiple instance on windows
Multiple instance on windows
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
 
Passwordless login with unix auth_socket
Passwordless login with unix auth_socketPasswordless login with unix auth_socket
Passwordless login with unix auth_socket
 
Mysql
Mysql Mysql
Mysql
 
TrinityCore server install guide
TrinityCore server install guideTrinityCore server install guide
TrinityCore server install guide
 
Intalacion de owncloud
Intalacion de owncloudIntalacion de owncloud
Intalacion de owncloud
 
Service discovery and configuration provisioning
Service discovery and configuration provisioningService discovery and configuration provisioning
Service discovery and configuration provisioning
 

More from Mohd yasin Karim

1. centos tutorial
1. centos tutorial1. centos tutorial
1. centos tutorial
Mohd yasin Karim
 
5. centos security
5. centos security5. centos security
5. centos security
Mohd yasin Karim
 
4. Centos Administration
4. Centos Administration4. Centos Administration
4. Centos Administration
Mohd yasin Karim
 
6. centos networking
6. centos networking6. centos networking
6. centos networking
Mohd yasin Karim
 
Microsoft<sup>®</sup> office training
Microsoft<sup>®</sup> office trainingMicrosoft<sup>®</sup> office training
Microsoft<sup>®</sup> office training
Mohd yasin Karim
 
Phpmyadmin administer mysql
Phpmyadmin administer mysqlPhpmyadmin administer mysql
Phpmyadmin administer mysql
Mohd yasin Karim
 
Mysql workbench 5
Mysql workbench 5Mysql workbench 5
Mysql workbench 5
Mohd yasin Karim
 
Mysql an introduction
Mysql an introductionMysql an introduction
Mysql an introduction
Mohd yasin Karim
 

More from Mohd yasin Karim (10)

1. centos tutorial
1. centos tutorial1. centos tutorial
1. centos tutorial
 
3. introduction of centos
3. introduction of centos3. introduction of centos
3. introduction of centos
 
5. centos security
5. centos security5. centos security
5. centos security
 
4. Centos Administration
4. Centos Administration4. Centos Administration
4. Centos Administration
 
6. centos networking
6. centos networking6. centos networking
6. centos networking
 
2. introduction to linux
2. introduction to linux2. introduction to linux
2. introduction to linux
 
Microsoft<sup>®</sup> office training
Microsoft<sup>®</sup> office trainingMicrosoft<sup>®</sup> office training
Microsoft<sup>®</sup> office training
 
Phpmyadmin administer mysql
Phpmyadmin administer mysqlPhpmyadmin administer mysql
Phpmyadmin administer mysql
 
Mysql workbench 5
Mysql workbench 5Mysql workbench 5
Mysql workbench 5
 
Mysql an introduction
Mysql an introductionMysql an introduction
Mysql an introduction
 

Recently uploaded

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 

Recently uploaded (20)

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 

My sql administration

  • 1. Mohd Yasin Abd Karim yasin@teras-solution.com
  • 2. Configuring  Monitoring, Starting & Stopping  Managing Users and Connection  Performing backups  Others
  • 3.
  • 4. Mysqladmin or mysql  GUI ◦ MySQL Administrator ◦ MySQL Workbench ◦ phpMyAdmin
  • 5. OS packages place files in many areas and varies ◦ e.g. /usr/lib, /var/lib, /var/log, /etc  Source rpm, yum, .tar.gz, exe  Online/repo update ◦ #yum update mysql-*  For Ms Windows Environment C:>cd localmysqlbin C:localmysqlbin> Local folder normally Program Files folder
  • 6. Start MySQL process before create database  To configure MySQL start at boot time #chkconfig mysqld on  Or using GUI tools such as OS Services Management
  • 7. After boot time using the services commands #service mysqld start #service mysqld stop #Service mysqld restart  Remember to restart mysqld process every time after configuration changed
  • 8. to know whether your MySQL server is alive #pgrep mysqld  Should get response process ID numbers  Or #mysqladmin –u root –p ping  The "mysqld is alive" message tells you that your MySQL server is running ok. If your MySQL server is not running, you will get a "connect ... failed" message.
  • 9. my.cnf ◦ Watch out for /etc/my.cnf, /etc/mysql/my.cnf  To get the server listening on all interfaces, use 0.0.0.0 as the bind address. i.e.: --bind-address=0.0.0.0
  • 10. Configured to listen TCP/IP Port (default 3306)  Additional Instances ◦ Different Ports ◦ Different IP‟s using default Port  Local connection using Socket
  • 11. Login to MySQL server #mysql –h hostname –u root -p  Create a database msql> create database [databasename];  List all databases on the MySQL server msql> show databases;
  • 12. Swicth to a database msql> use [db_name];  To see all the tables in the db msql> show tables;  To delete a db msql> drop database [databasename];
  • 13. To see database‟s field formats msql> describe [table name];  To delete a table msql> drop table [table name];  Show all data in a table msql> SELECT * FROM [table name];
  • 14. SHOW TABLES;  SHOW WARNINGS;  SHOW STATUS; FLUSH STATUS;  SHOW VARIABLES;  SHOW VARIABLES LIKE „%size%‟;  SHOW VARIABLES LIKE „sort_buffer_size‟;  SHOW GLOBAL STATUS;
  • 15. to check version number of your MySQL server C:localmysqlbin>mysqladmin -u root version
  • 16. According to the /etc/my.cnf  Usually located in subdirectory /var/lib/mysql/ directory  Example : test database ◦ /var/lib/mysql/test
  • 17. Root or superuser account is used to create and delete database  New installation MySQL set password #mysqladmin –u root password new-password
  • 18. to know what else you can do with "mysqladmin", you should run the "-?" #mysqladmin –?
  • 19. Creating new user # mysql -u root -p mysql> use mysql; mysql> INSERT INTO user (Host,User,Password) VALUES('%','username',PASSWORD('password')); mysql> flush privileges;
  • 20. Change a user password from unix shell # mysqladmin -u username -h hostname.org -p password 'new-password'  Change user password from MySQL prompt # mysql -u root -p mysql> SET PASSWORD FOR 'user'@'hostname' = PASSWORD('passwordhere'); mysql> flush privileges;
  • 21. Update root password # mysqladmin -u root -p oldpassword newpassword  Allow the user “bob” to connect to server from localhost using password „passwd‟ # mysql -u root -p mysql> use mysql; mysql> grant usage on *.* to bob@localhost identified by 'passwd'; mysql> flush privileges;
  • 22. Give user privileges for a db. # 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;
  • 23. To update info already in table mysql> UPDATE [table name] SET Select_priv = 'Y',Insert_priv = 'Y',Update_priv = 'Y' where [field name] = 'user';  Delete a rows from table mysql> DELETE from [table name] where [field name] = 'whatever';  Update database permissions/privileges mysql> flush privileges;
  • 24. Dump all databases for backup # mysqldump -u root -ppassword --opt >/tmp/alldatabases.sql  Dump one database for backup # mysqldump -u username -ppassword --databases databasename >/tmp/databasename.sql  Dump a table from a database # mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql
  • 25. Restore database / table from backup # mysql -u username -ppassword databasename < /tmp/databasename.sql
  • 26. Example mysql> create table [table name] (personid int(50) not null auto_increment primary key,firstname varchar(35),middlename varchar(50),lastnamevarchar(50) default „yasin'); mysql> CREATE TABLE [table name] (firstname VARCHAR(20), middleinitial VARCHAR(3), lastname VARCHAR(35),suffix VARCHAR(3),officeid VARCHAR(10),userid VARCHAR(15),username VARCHAR(8),email VARCHAR(35),phone VARCHAR(25), groups VARCHAR(15),datestamp DATE,timestamp time,pgpemail VARCHAR(255));
  • 27. yasin@teras-solution.com

Editor's Notes

  1. By default MySQL listens on all your interfaces for database queries from remote MySQL clients. You can see this using netstat -an. Your server will be seen to be listening on IP address 0.0.0.0 (all) on TCP port 3306. Multiple MySQL Instances