Connection of Database from Linux shell
by admin on Oct.10, 2008, under mysql linux
mysql advantages and Connectivity from unix / linux shell
•Ability to handle an unlimited number of simultaneous users.
•Capacity to handle 50,000,000+ records.
•Very fast command execution, perhaps the fastest to be found on the market.
•Easy and efficient user privilege system.
Connect mysql from linux shell :
shell> mysql ?u arvind –p
where arvind is the username
(might work for root for username)
Enter password when prompted.
To select database in mysql
mysql> use mydb;
Result:
Database changed Mydb>
You now are connected to mydb database
Create table in mysql :
mysql> CREATE TABLE test ( > name VARCHAR (15), > email VARCHAR (25), > phone_number
INT, > ID INT NOT NULL AUTO_INCREMENT, > PRIMARY KEY (ID));
Insert command in mysql :
mysql> INSERT INTO test VALUES mysql> (’Bugs Bunny’, ‘carrots@devshed.com’, mysql> 5554321,NULL);
Delete a record from mysql table
mysql> DELETE FROM test mysql> WHERE (name = “arvind”);
Update a record in mysql database :
mysql> UPDATE test SET name = ‘arvind1′ mysql> WHERE name = “arvind2″;
arvind2 will be replace with arvind1
selection and order by mysql :?
mysql> SELECT * FROM test WHERE mysql> (name = “arvind”) ORDER BY mysql>
phone_number;