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)
    );
     
  2. renith

    renith Starter

    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    10
    Location:
    chennai
    123down voteaccepted


    Your MySQL binaries should be somewhere under your XAMPP folder. Look for a /bin folder, and you'll find the mysql.exe client around. Let's assume it is in c:\xampp\mysql\bin, then you should fireup a command prompt in this folder.

    That means, fire up "cmd", and type:

    cd c:\xampp\mysql\bin
    mysql.exe -u root --password
    If you want to use mysqldump.exe, you should also find it there.

    Log into your mysql server, and start typing your commands.

    Hope it helps...
    more details visit our website:
    Oracle Training in Bangalore
    Oracle Training in Chennai