You just need to modify the query and login credential then run the below command of database server .
mysql -e “select * FROM tabledata” -u satya -pPrakash databasename > /home/ob_cdr.txt
However i have written a shell script to do this job.
rm “$OUTPUTDIR/*txt” > /dev/null 2>&1
databases=`mysql –user=$USER –password=$PASSWORD -e “SHOW DATABASES;” | tr -d “| ” | grep -v Database`
for db in $databases; do
if [[ “$db” = “databasename” ]] ; then
echo “Dumping cdr table of database: $db”
mysql -e “SELECT * FROM tablename ” -u root -pROOTPASSWORD asterisk > $OUTPUT/ob_cdr.txt
echo “Dumping database TABLE: $db”
And then make the script executable.
- 38To enable the query log, put this in /etc/my.cnf in the [mysqld] section log = /path/to/query.log #works for mysql < 5.1.29 Also, to enable it from MySQL console SET general_log = 1; Remember that this logfile can grow very big on a busy server. update: With mysql 5.1.29+ , the log option is deprecated. To specify…
- 31What is database? Database is an organized collection of information about an entity having controlled redundancy and serves multiple applications. DBMS (database management system) is an application software that is developed to create and manipulate the data in database. A query language can easily access a data in a database.…