Running mysql queries in command line is possible with a option
to execute the SQL statement and quit.
Follow the syntax below :
mysql -u user -p -e ‘SQL Query’ Database_Name
Where,
-u : Specify mysql database user name
-p : Prompt for password
-e : Execute sql query
SQL Query : Specify your SQL query
Database_Name : Specify database name
eg :
verman@desktop:~$ mysql -u [...]
Archive for December, 2008
How to run MySQL SQL queries on GNU/Linux command line?
Posted in MYSQL, tagged MYSQL on December 19, 2008 | 3 Comments »
Basic MySQL Commands for Begineers
Posted in MYSQL, tagged MYSQL on December 18, 2008 | Leave a Comment »
1. How to login mysql from GNU/Linux shell ?
$mysql -h hostname -u root -p
2. How to create a database ?
mysql> create database [Database_Name];
3. How to list all databases ?
mysql> show databases;
4. How to list all the tables in a database ?
mysql> show tables;
5. How to switch to a database ?
mysql> use [Database_Name];
6. How to list [...]
