PHP MySql Web Hosting

PHP and MySQL Web Development

produces output consisting of semicolon-terminated SQL statements can

Filed under: MySQL Solutions — webmaster @ 2:12 am

produces output consisting of semicolon-terminated SQL statements can be used as an input source for mysql. This can be useful in many ways. For example, the mysqldump utility is used to generate database backups. It writes a backup as a set of SQL statements that recreate the database, so to process mysqldump output, you feed it to mysql. This means you can use the combination of mysqldump and mysql to copy a database over the network to another MySQL server: [5] Under Windows, the equivalent would be the “useless use of type award”: % mysqldump cookbook | mysql -h some.other.host.com cookbook Program-generated SQL also can be useful when you need to populate a table with test data but don’t want to write the INSERT statements by hand. Instead, write a short program that generates the statements and send its output to mysql using a pipe: % generate-test-data | mysql cookbook 1.17.4 See Also mysqldump is discussed further in Chapter 10. 1.18 Specifying Queries on the Command Line 1.18.1 Problem You want to specify a query directly on the command line for mysql to execute. 1.18.2 Solution mysql can read a query from its argument list. Use the -e (or –execute) option to specify a query on the command line. 1.18.3 Discussion For example, to find out how many records are in the limbs table, run this command: % mysql -e “SELECT COUNT(*) FROM limbs” cookbook +———-+ | COUNT(*) | +———-+ | 12 | +———-+ To run multiple queries with the -e option, separate them with semicolons: % mysql -e “SELECT COUNT(*) FROM limbs;SELECT NOW( )” cookbook +———-+ | COUNT(*) | +———-+ | 12 |

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost MySQL Web Hosting services

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by PHP MySQL Web Hosting