How to use PHP to access MySQL shell? -


currently have shell script within application depending on argument pass it, log either live or development mysql database shell. works fine, no problem there.

the issue/challenge having if in case mysql credentials (host / port) change either live or development database manually have edit shell script, updating new arguments. problem is, have done before never want have again.

what have php script (mysql.sh.php) when executed, depending on argument passed log either live or development database shell. how differ shell script pull current credentials (and host , port) php configuration class , pass arguments shell command log respective database.

below gives illustration of attempting.

#!/usr/bin/php  <?php     include ('common.php');     //pull info php class right here      exec("mysql --host={$myhostnotyours} --user={$myusernotyours} -p{$mypassnotyours} {$thedatabase}"); 

what expect or

mysl> 

however, command hangs , not presented mysql shell.

i know if there way accomplish trying.

thanks!


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -