Friday
Besides from using perl scripts, phpmyadmin and customized php pages, here is a quick way to fetch data from mysql database using shell script.
Just make sure you are currently running mysql from your box with existing database and table inside.
First, launch your favorite linux editor and create a bash script and paste the following bash codes inside and save.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/bin/bash
# july 03 2007 – vertito
# this script retrieves data from mysql using bashdbase=`mysql -uMYSQLUSENAME -pMYSQLPASSWORD -e”use MYDATABASE; select * from MYTABLE where id = 1;”`
for data in $dbase ;
do
echo $data
doneecho Done.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#chmod 700 yourscript.sh
#./yourscript.sh
works like a charm!
Dont forget to change the following wordings:
MYSQLUSERNAME = your mysql username access with your mysql server
MYSQLPASSWORD = your mysql password
MYDATABASE = your running mysql database name
MYTABLE = your selected table name