How you will Create a database on the mysql server with unix shell

mysql> create database databasename; To create a MySQL database on a server using the Unix shell, you can use the mysqladmin or mysql command-line tools. Here’s an example using the mysql command: Open a terminal on your Unix-based system. Log in to the MySQL server using the following command. You will be prompted to enter … Read more

How to do login in mysql with unix shell

By below method if password is pass and user name is root # [mysql dir]/bin/mysql -h hostname -u root -p pass To log in to MySQL using the Unix shell, you can use the mysql command along with the appropriate options. Here’s the general syntax: bash mysql -u your_username -p Replace your_username with your MySQL … Read more

Interview Scenario on MySQL:

Interview Scenario on MySQL: There is a table named SAMPLE, and we want to delete all the data from the table. Which is better option? delete * from SAMPLE truncate table SAMPLE In delete cursor is on the current location, data is deleted from the table but memory is not released by the table, by which … Read more

Import data into MySQL from any file

How to Import data into MySQL from any file: Mysql –u root <db.sql (for database and tables) Mysql –u root <data.sql (for data into tables) To import data into MySQL from a file, you can use the LOAD DATA INFILE statement. Here’s a basic example of how to use it: sql LOAD DATA INFILE ‘path/to/your/file.csv’ … Read more

Syntax and Queries

MySQL Commands: Show databases; Create database db_name; Use dbname; Show tables; Create table tb_name(id int, name varchar(20)); Desc tb_name; Insert into tb_name values(101 , ‘name of person’); Insert into tb_name (id) values(102); Update tb_name set name=’person name’ where id=102; Select * from tb_name; Delete from tb_name where id=102; Drop table tb_name; Drop database db_name; Rename … Read more