-4
votes
1answer
27 views

How can i write a Mysql shell script without Mysql password and also i want to setup cron job for that shell script [on hold]

I want to write a bash shell script and i don't want to hard code my mysql password in the script and also in the system. I have tried with one solution .my.cnf file and added the entries of Mysql ...
0
votes
2answers
67 views

Script to change MySQL password from command line

I host some websites for people with a simple server. I can't afford nifty things like cpanel, and I don't want to waste memory on a giant blob of perl like webmin. I am wondering if anyone has come ...
4
votes
2answers
168 views

supress expansion of * in echo

I am working on a script which dynamically executes some queries on daily basis. These queries are coming from a table in the database. Here is the sample output of the query table: ...
0
votes
2answers
293 views

FreeBSD rc.d scripts do not return to proper shell

My interesting problem is that when running some rc.d scripts they do not actually drop back to the root shell, but leave me at an intermediate shell as the user they're supposed to be running as. A ...
1
vote
1answer
192 views

Mysql incremental backup and point in time recovery

I have a requirement for doing Incremental backup of MySQL database. For which I'm writing a shell script using the concept of binary logs. Now, the scenario is such that a full-backup will happen ...
0
votes
2answers
896 views

Shell Script to Start Mysql Server if not running

I have written a shell script to start mysql server & send a mail to admin user if it's restarted via shell script. What i am facing an issue if I run this shell script on terminal it's work ...
0
votes
1answer
1k views

mysql -e option with variable data - Pass the variable value to insert sql statement in shell script

The following shell script is not inserting the data to the table. How to pass the variable value to insert sql statement in a shell script. id=0 while true do id=`expr $id + 1`; mysql -u root ...
1
vote
1answer
395 views

Can't restart mysql from cron job

I have a problem where MySQL (running on Ubuntu 12.04 with all latest updates) dies after a few days so put this script into a cron job that runs as root every 60 seconds. Everything works except ...
3
votes
4answers
3k views

Connect to MySQL trough command line without need root password

I'm building a Bash script for some tasks. One of those tasks is create a MySQL DB from within the same bash script. What I'm doing right now is creating two vars: one for store user name and the ...
0
votes
2answers
843 views

MySql information_schema error - Lock Tables

I have written a quick shell script to take each backup of MySql database & that works good. I was using the same scripts for all mysql servers tool, I have installed it on ubuntu 10.04 server. ...
3
votes
4answers
3k views

From a shell script, how can I check whether a table in MySQL database exists or not?

I am trying to write a script which allows a user to select the what manipulation he needs to do on a table. I want to check if the table exists or not. If it exists I will continue the other things ...
-1
votes
2answers
145 views

Would it be better security to write a backup script in PHP or shell? [closed]

I have a server running Ubuntu 10, it mostly has PHP websites with MySQL databases. I need to write a backup script to backup the database to zip up all the php files. Is it better security to ...
0
votes
2answers
146 views

Cannot log into mysql after invoking mysql from shell script

(My first question here, so if I am flouting any conventions, I apologize in advance!) This is my first attempt at creating a shell script. I am trying to create new databases and users and passwords ...
0
votes
2answers
538 views

Convert string to xml in shell script?

I have written a script which is fetching data from database. Now I want to enhance that script to create a xml file with data which is return by database. How may i convert that string to xml file ...
0
votes
3answers
3k views

How to run mysql commands through shell script?

mysql -u root -pmysql; SELECT TABLE_NAME AS "Table Name", table_rows AS "Quant of Rows", ROUND((data_length + index_length)/1024/1024,2) AS "Total Size Mb" FROM information_schema.TABLES WHERE ...
4
votes
3answers
4k views

Does mysqldump return a status?

I am creating a script that backups a mysql db using the mysqldump utility. I am writing this script in the shell "sh". I would like to capture the output status of mysqldump in the script (i.e. if ...