13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

298 Chapter 12 Advanced <strong>MySQL</strong> Administration<br />

Table 12.7 SHOW Statement Syntax<br />

Variation Description<br />

SHOW DATABASES [like_or_where] Lists available databases.<br />

SHOW [OPEN] TABLES [FROM database] Lists tables from the database currently in use, or from the database called database.<br />

[like_or_where]<br />

SHOW [FULL] COLUMNS FROM table [FROM Lists all the columns in a particular table from the database currently in use, or from the database specified.<br />

database] [like_or_where] You might use SHOW FIELDS instead of SHOW COLUMNS.<br />

SHOW INDEX FROM table [FROM database] Shows details of all the indexes on a particular table from the database currently in use, or from the database called database<br />

if specified.You might use SHOW KEYS instead.<br />

SHOW [GLOBAL | SESSION] STATUS Gives information about a number of system items, such as the number of threads running.The LIKE clause is used to<br />

[like_or_where] match against the names of these items, so, for example,‘Thread%’ matches the items ‘Threads_cached’, ‘Threads_connected’,‘Threads<br />

created’, <strong>and</strong> ‘Threads running’.<br />

SHOW [GLOBAL|SESSION] VARIABLES Displays the names <strong>and</strong> values of the <strong>MySQL</strong> system variables, such as the version number.<br />

[like_or_where]<br />

SHOW [FULL] PROCESSLIST Displays all the running processes in the system—that is, the queries that are currently being executed. Most users will see<br />

their own threads, but if they have the PROCESS privilege, they can see everybody’s processes—including passwords if they<br />

are in queries.The queries are truncated to 100 characters by default. Using the optional keyword FULL displays the full<br />

queries.<br />

SHOW TABLE STATUS [FROM database] Displays information about each of the tables in the database currently being used, or the database called database if it is<br />

[like_or_where] specified, optionally with a wildcard match.This information includes the table type <strong>and</strong> the time each table was last<br />

updated.<br />

SHOW GRANTS FOR user Shows the GRANT statements required to give the user specified in user his current level of privilege.<br />

SHOW PRIVILEGES Shows the different privileges that the server supports.<br />

SHOW CREATE DATABASE database Shows a CREATE DATABASE statement that would create the specified database.<br />

SHOW CREATE TABLE tablename Shows a CREATE TABLE statement that would create the specified table.<br />

SHOW [STORAGE] ENGINES Shows the storage engines that are available in this installation <strong>and</strong> which is the default. (We discuss storage engines further<br />

in Chapter 13,“Advanced <strong>MySQL</strong> Programming.”)<br />

SHOW INNODB STATUS Shows data about the current state of the InnoDB storage engine.<br />

SHOW WARNINGS [LIMIT [offset,] row_count] Shows any errors, warnings, or notices generated by the last statement that was executed.<br />

SHOW ERRORS [LIMIT [offset,] row_count] Shows only the errors generated by the last statement that was executed.

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

Saved successfully!

Ooh no, something went wrong!