11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

www.it-ebooks.infoCHAPTER 27 • THE MANY MYSQL CLIENTS%>mysql -u jason --prompt="(\u@\h) [\d]> " -p corporateOnce you’re logged into the console, the prompt will appear like so:(jason@localhost) [corporate]>To render the change more permanent, you can also make the change in the my.cnf file, under the[mysql] section:[mysql]...prompt=(\u@\h) [\d]>Finally, on Linux only, you can include the hostname on the prompt via the MYSQL_PS1 environmentvariable:%>export MYSQL_PS1="(\u@\h) [\d]> "■ Note A complete list of flags available to the prompt are available in the <strong>MySQL</strong> manual.Outputting Table Data in HTML and XMLThis cool but largely unknown feature of the mysql client allows you to output query results in XML andHTML formats, using the --xml (-X) and --html (-H) options, respectively. For example, suppose youwant to create an XML file consisting of the databases found on a given server. You could place thecommand SHOW DATABASES in a text file and then invoke the mysql client in batch mode, like so:%>mysql -X < showdb.sql > serverdatabases.xmlThe result is that a file named serverdatabases.xml is created that consists of output similar to thefollowing:information_schemacorporatetest511

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!