1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

How to connect and create database in mysql using command line in xampp

Discussion in 'Other Databases' started by TechQueryPond, Apr 6, 2016.

  1. TechQueryPond

    TechQueryPond Active Member

    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    55
    Location:
    INDIA




    How to connect and create database in MySQL using command line in xampp


    By following below steps you can connect / create database.

    Assume that you xampp install in C drive.

    When you open command prompt then give following path.

    cd xamppmysqlbinmysql.exe

    Syntax to connect database :

    e.g : mysql -h root -p;

    when you type -p then it ask for password.

    Syntax to create database :


    CREATE DATABASE TESTDB;

    To view list of database :

    SHOW DATABASES;

    To use specific database :

    USE TESTDB;

    To show all list of table in database :

    SHOW TABLES;

    Syntax to create new table :

    Code (SQL):
    CREATE TABLE Persons

    (
    PersonID INT,
    LastName VARCHAR(255),
    FirstName VARCHAR(255),
    Address VARCHAR(255),
    City VARCHAR(255)
    );