2
votes
1answer
63 views

How do I avoid echoing password (two simultaneous prompts)?

The command I'm talking about is this: mysqldump -u root -p DB | mysql -u root -p DB2 And here's the output: Enter password: Enter password: MYPASS As far as I can tell, after I enter first ...
3
votes
2answers
651 views

Mysql query resultset in bash script

I am using the bash script to connect to the mysql database and execute a query. I use the below script to connect to the database and execute the query. #!/bin/bash Total_Results=$(mysql -h ...
1
vote
1answer
99 views

mysql database dump script adding fuctionality to skip dumped database

I'm using the following script to dump my database. it works great. I want to add functionality that it first checks if a database table is already dumped or not, if a dump exists then it should be ...
0
votes
2answers
538 views

Run mysqld_safe in background

I have a bash script that installs mysql for me. One line, that executes mysqld_safe, makes the script to hang - it won't continue to the following code. Obviously there's ampersand at line's end, ...
0
votes
3answers
472 views

How to create an interactive bash script to collect arguments for a command in linux?

I'm trying to create an interactive bash script where I can collect user input variables to be used as arguments in another command. Can someone provide me an example of this? Currently i want to do: ...
1
vote
1answer
634 views

Convert mysql count(*) to int in bash?

I'd like to execute this and check if count is 0, 1 or > 1 in bash. mysql -e "select count(*) from mydb.mydb;" The output is: +----------+ | count(*) | +----------+ | 0 | +----------+ I ...
4
votes
4answers
4k views

How can I check if mysql is installed using a bash script?

I need to check if mysql is installed from within a bash script. What would be an efficient way of doing that? I thought I could do this: if [ ! -f `which mysql` ] ; then echo "foo" fi But I ...
5
votes
2answers
1k views

Get a progress indicator when importing MySQL databases

I often import MySQL databases, and this can take a while. There is no progress indicator whatsoever. Can one be shown, somehow? Either records imported, MB imported, or tables imported... anything is ...
1
vote
2answers
470 views

Script that uses MySQL query to automatically remove output

I have this query that outputs updates older than 7 days from a database. How would I make a script that takes the MySQL statement and puts it into a script to be executed by cron. echo "select name, ...
2
votes
2answers
188 views

List files that occur lexically after/greater than a given prefix (or, run database upgrade scripts in a proper order)

I'm trying to create a shell script that runs through a bunch of SQL scripts. I've these files: $ ls upgrade/ 01-foo.sql 02-bar.sql 02-baz.sql 03-foo1.sql 04-buz.sql And I've got the version of ...