MARIA DB Xampp Server

How to use mariadb command line in XAMPP Server

Step 1:

Move to your Xampp server Drive via CMD

Example i have install my xampp server in D Directory

so you have to promote the CMD according to your Directory

C:\Users\Arick> cd /d d:\xampp ( you will select according to your drive)

d:\xampp>cd mysql

d:\xampp\mysql>cd bin

D:\xampp\mysql\bin> mysql -h localhost -u root

D:\xampp\mysql\bin> mysql -u root -h 127.0.0.1

(-h) used for localhost

(-u) used for root

After Promote these commands you will get MariaDB [(none)]>

in the quotation you found the [(none)] right now here we don’t select any database if we will select any database it will reflect.

Step 2:

SHOW DATABASES : – Display all database from directory

Example Like this .

Still we don’t select any Particular Database .Show Databases use to display all Database into the Directory.

STEP 3:

USE DATABASE: Now we are here selection Particular Database via USE CMD ,

USE CMD Also used to switch to next database.

suppose here now we are using Arick Database

you only need to type USE Ind , you will move to Ind database.

EXAMPLE : USE I_LOVE_MY_COUNTRY; (I LOVE MY COUNTRY IS A DATABASE )

SELECTED Particular Database

STEP 4:

SHOW tables : – it will show all the tables , how many tables in database.

STEP 5:

SELECT Particular table you can INSERT, UPDATE ,ALTER, Via CMD

Here i have selected Particular Table

Just make a siple cmd – MariaDB [delhi_buss_record_system]> SELECT * FROM employee;

we can also fetch according to the need,

MariaDB [delhi_buss_record_system]> SELECT emp_id,first_name ,hire_date FROM employee WHERE Driver_id=1;

MariaDB [delhi_buss_record_system]> SELECT emp_id,first_name ,hire_date FROM employee WHERE Driver_id=1;

here Fetch data according to id.


MariaDB [delhi_buss_record_system]> SELECT first_name,hire_date FROM employee ORDER BY emp_id ASC;

Here Fetch Data via ASC (ascending order)

MariaDB [delhi_buss_record_system]> SELECT first_name FROM employee ORDER BY first_name DESC;

Here Fetch Data via DESC(Descending order)

CREATE DATABASE USING CMD

MariaDB [(none)]> CREATE DATABASE Query_Panel;

CREATE TABLES CMD

USE Query_Panel

MariaDB [Query_Panel]> CREATE TABLE Q_Emp_Details (queryp_id INT NOT NULL PRIMARY KEY,Q_NAME CHAR(25),Q_ADDRESS VARCHAR(50));

CREATED TABLE

ALTER TABLE ( Single Column ADD)

MariaDB [Query_Panel]> ALTER TABLE q_emp_details ADD COLUMN Status VARCHAR(30);

ALTER TABLE (Multiple Column ADD in Single CMD)

MariaDB [Query_Panel]> ALTER TABLE Q_Emp_Details ADD COLUMN Joining_date VARCHAR(50),ADD COLUMN Shift VARCHAR(25),ADD COLUMN F_NAME VARCHAR(30),ADD COLUMN P_ADDRESS VARCHAR(30);

Describe

MariaDB [Query_Panel]> DESCRIBE q_emp_details;

Describe Table

INSERT QUERY

MariaDB [Query_Panel]> INSERT INTO q_emp_details (queryp_id,Q_NAME,Q_ADDRESS,Joining_date,Shift,F_NAME,P_ADDRESS,Status) VALUES (“001″,”QUERYPANEL”,”DELHI”,”12-14-1991″,”NIGHT”,”S”,”PAN”,”SINGLE”);

MariaDB [Query_Panel]> INSERT INTO q_emp_details VALUES (“002″,”QUERY PANEL”,”DELHI India”,”1-14-1991″,”Day”,”S”,”PANjab”,”Married”);

INSERT QUERY

MULTIPLE INSERT IN SINGLE QUERY

MariaDB [Query_Panel]> INSERT INTO q_emp_details VALUES (“003″,”PANEL”,”India”,”1-14-1997″,”Day”,”Sha”,”der”,”Single”),(“004″,”ANEL”,”LHI Indi”,”1-14-1891″,”Both”,”SD”,”PAN”,”Married”),(“005″,”NEL”,”DELHI Ind”,”1-14-1791″,”Day”,”SP”,”PANjab”,”SINGLE”),(“0022″,”QJJUERY OOPANEL”,”U U DELHI India”,”5-14-1997″,”Day”,”S”,”jab”,”Married”),(“006″,”Y PANEL”,”DEL In”,”1-5-1991″,”Day”,”SO”,”Njab”,”Married”),(“0082″,”NELP”,”PDELHI India”,”1-14-1891″,”NIGHT”,”SH”,”ab”,”Married”);

SELECT QUERY USING ASC / DESC

MariaDB [Query_Panel]> SELECT Q_NAME FROM q_emp_details ORDER BY Q_NAME ASC;

MariaDB [Query_Panel]> SELECT * FROM q_emp_details ORDER BY queryp_id DESC;
MariaDB [Query_Panel]> SELECT queryp_id FROM q_emp_details ORDER BY Q_NAME DESC;

UPDATE QUERY / AND /OR

MariaDB [Query_Panel]> UPDATE q_emp_details SET queryp_id=”21″ WHERE Q_NAME=”NELP”;

MariaDB [Query_Panel]> UPDATE q_emp_details SET Q_ADDRESS=”LAX DEL” AND Joining_date=”12-6-2019″ WHERE queryp_id=”22″;

CHANGE COLUMN NAME

MariaDB [query_panel]> ALTER TABLE q_emp_details CHANGE COLUMN Shift SHIFT_TIMING VARCHAR(50);

Leave a Reply

Your email address will not be published. Required fields are marked *