Operating System - HP-UX
1748041 Members
5160 Online
108757 Solutions
New Discussion юеВ

Re: mysql [database connectivity] in shell scripting hpux

 
SOLVED
Go to solution
Vinayak_HPUX
Frequent Advisor

mysql [database connectivity] in shell scripting hpux

I have setup mysql server and client both are working fine.I am having problem of database connectivity.....plz let me know how to do the db[mysql connectivity] thru shell scripting?
"Success is matter of law not luck, Make ur own & follow them -Shivkhera[You Can Win] "
7 REPLIES 7
Rasheed Tamton
Honored Contributor
Solution

Re: mysql [database connectivity] in shell scripting hpux

The question is not clear. But can you please post how you manually connect to mysql from the command prompt. So, it would be easy for us to automate.
Steven E. Protter
Exalted Contributor

Re: mysql [database connectivity] in shell scripting hpux

Shalom,

The mysql client/database server manager is at a different location than Linux. But the command line and interactive commands are the same, they were merely ported and compiled on HP-UX, by HP, if you used mysql from the HP Web suite on http://software.hp.com (search Internet Express).

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Vinayak_HPUX
Frequent Advisor

Re: mysql [database connectivity] in shell scripting hpux

For java language there is block of jdbc.odbc connection code ....similarly is there any block code to open , connect database in shell scripting?
"Success is matter of law not luck, Make ur own & follow them -Shivkhera[You Can Win] "
Rasheed Tamton
Honored Contributor

Re: mysql [database connectivity] in shell scripting hpux

If I get your question clearly, yes - the databases can be connected through the script. Few of them, using the scripts to start and stop the databases.

I had an old note reg. mysql for Linux. May be you can try it from the command prompt.

mysqladmin -uUSERNAME -pPASSWORD

Check in /sbin/init.d whether there is a script related to mysql (mysql.server, etc.)
Vinayak_HPUX
Frequent Advisor

Re: mysql [database connectivity] in shell scripting hpux

My clear Q? is I want to access database [mysql] tables thru shell script ...how to do ?
"Success is matter of law not luck, Make ur own & follow them -Shivkhera[You Can Win] "
Rasheed Tamton
Honored Contributor

Re: mysql [database connectivity] in shell scripting hpux

You can do it. You do the sequence of commands you use manually line by line in the script file and automate it. The end point is you connect to database and pass the SQL statements from the script.

Something like this:

#!/usr/bin/sh
mysql -u username -ppassword -D dbname <SELECT * from table;
EOF

Save and execute script as follows:
$ chmod +x script.sh
$ ./script.sh
Vinayak_HPUX
Frequent Advisor

Re: mysql [database connectivity] in shell scripting hpux

I got solutions
"Success is matter of law not luck, Make ur own & follow them -Shivkhera[You Can Win] "