Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Databases»MariaDB»How to Create and Drop Database in MySQL

    How to Create and Drop Database in MySQL

    RahulBy RahulFebruary 4, 20142 Mins Read

    MySQL is the most popular database for web development. After installing mysql on our system. Let’s start with the database creation.. In this article we will describe you to How to create and drop database in MySQL server.

    1. Create Database from MySQL Prompt:

    To create database from mysql command prompt, first login to your mysql server using administrative privileges.

    # mysql -u root -p
    
    mysql> CREATE DATABASE exampledb;
    

    You can also set the default character set to utf8 by defining with command as below.

    mysql> CREATE DATABASE exampledb DEFAULT CHARACTER SET utf8;
    

    2. Create Database from System Command Prompt:

    Using mysqladmin command we can create database from Linux shell or windows command line. . This is useful for running query from shell or bash scripts for automation tasks.

    # mysqladmin -u root -p create exampledb
    

    3. Drop Database from MySQL Prompt:

    To drop database from mysql command prompt, first login to your mysql server using administrative privileges.

    # mysql -u root -p
    
    mysql> DROP DATABASE exampledb;
    

    4. Drop Database from System Command Prompt:

    Using mysqladmin command we can also drop any database from Linux shell or windows command line. This is useful for running query from shell scripts.

    # mysqladmin -u root -p drop exampledb
    
    database MySQL mysqladmin
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleTop 4 Alternatives of phpMyAdmin
    Next Article How to Get Default Windows Password in AWS Instance

    Related Posts

    Backup MySQL Databases to Amazon S3 (Shell Script)

    Updated:May 28, 20222 Mins Read

    How to Install MariaDB on Ubuntu 22.04

    Updated:May 28, 20222 Mins Read

    How To Install Linux, Nginx, MySQL, & PHP (LEMP Stack) on Ubuntu 22.04

    Updated:April 7, 20227 Mins Read

    How To Install MySQL Server on Ubuntu 22.04

    Updated:April 6, 20224 Mins Read

    How to Install Apache, MySQL, PHP (LAMP Stack) on Ubuntu 22.04

    Updated:June 28, 20225 Mins Read

    How To Install MariaDB on Debian 11

    4 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How To Install Docker on Ubuntu 22.04
    • How to Install Bower on Ubuntu 22.04 & 20.04
    • How to run “npm start” through Docker
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.