Scripting

Shell script to backup mySQL database

Shell script to backup MySql database mysql-backup.bash #!/bin/bash # Shell script to backup MySql database # To backup Nysql databases file to /backup dir and later pick up by your # script. You can skip few databases from backup too. # For more info please see (Installation info): # http://www.cyberciti.biz/nixcraft/vivek/blogger/2005/01/mysql-backup-script.html # Last updated: Aug – […]

Read More
Linux

Bash misc tips

Bash debugging A nice thing to do is to add on the first line #!/bin/bash -x This will produce some interesting output information Reading user input with read In many ocations you may want to prompt the user for some input, and there are several ways to achive this. This is one of those ways: […]

Read More
Linux

Import csv data to mysql

This is a short note about how to import comma separated data, CSV, from a file into a mysql database from a shell. Log in to your mysql database and choose the database you are going to import into. Type in the following in the mysql console to import from the CSV file load data […]

Read More
Scripting

mySQL dump i batch mode

# mysql dbname -B -N -e “SELECT serial FROM serials” >/path/to/outfile -B or –batch: prints rows tab-separated and turns off the borders -N or –skip-column-names: leaves out the header row

Read More