Tag Archives: sql tutorials for beginners

How to select database using command line in Mysql

Use the following command to select database using command line in Mysql.

1 . Grant Permission

GRANT ALL PRIVILEGES ON `database_name`.* TO 'username'@'localhost'WITH GRANT OPTION;

2 . Now Select Database

Use database_name;

you will be switch to this database.

How to import database using command line in MySQL

How to import database using command line in MySQL

Use the following command to import database using command line in MySQL :

mysql -u username -p password database_name < physical location of the file

Another very simple example :

mysql > Use database_name;

mysql> source C:\Users\mydatabase.sql(path of the file you want to import);

How to update row using joins in MYSQL | to updtae row ,data using joins in sql

You can update row using joins in MYSQL as follows :

 

update TABLE_1 join TABLE_2  on   TABLE_1.id=TABLE_2.user_id SET  TABLE_1.name =”Test”  where TABLE_2.user_id=’12’ ;