hi,
The easiest way is probably with a CGI script (placed in /srv/www/cgi-bin/ on most Linux systems).
Here's some sample code:
Code:
#!/bin/bash
echo -e "Content-Type: text/plain\n"
echo "show tables;" | /usr/bin/mysql -u root mysql
The "use mysql" is replaced by the database name on the command line, and the "exit" is implied by the end of input file, leaving only the "show tables". If you prefer the long syntax, or want to add more SQL commands, this format should work:
Code:
#!/bin/bash
echo -e "Content-Type: text/plain\n"
/usr/bin/mysql -u root <<!SQL
use mysql;
show tables;
exit;
!SQL
In both cases, you might need to change path names & user names (root in my example). You might also have to specify a password.
This (list of tables) is potentially sensitive information, which could help a hacker craft an attack against your DB, so don't expose it to too many people unnecessarily :-)
I hope this helps.
Regards,
Clifford