Advanced MySQL CHAPTER 11 255 If you leave the database parameter off, the SHOW COLUMNS statement will default to the database currently in use. You can also use the notation: show columns from ; 11 ADVANCED MYSQL One other very useful variation of the SHOW statement can be used to see what privileges a user has. For example, if we run the following, we’ll get the output shown in Figure : show grants for bookorama; +------------------------------------------------------------------------------------------------+ | Grants for bookorama@% | +------------------------------------------------------------------------------------------------+ |GRANT USAGE ON *.* TO 'bookorama'@'%' IDENTIFIED BY PASSWORD '6a87b6810cb073de' | |GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON books.* TO 'bookorama'@'%' |. | Advanced MySQL 255 Chapter 11 If you leave the database parameter off the SHOW COLUMNS statement will default to the database currently in use. You can also use the notation show columns from One other very useful variation of the SHOW statement can be used to see what privileges a user has. For example if we run the following we ll get the output shown in Figure show grants for bookorama ------------------------------------------------------------------------------------ Grants for bookorama@ ------------------------------------------------------------------------------------ GRANT USAGE ON . TO bookorama S IDENTIFIED BY PASSWORD 6a87b6810cb073 de GRANT SELECT INSERT UPDATE DELETE CREATE DROP INDEX ALTER ON books. TO bookorama @ ----------------------------------------------------------------------------------- Figure The output of the SHOW GRANTS statement. The GRANT statements shown are not necessarily the ones that were executed to give privileges to a particular user but rather summary equivalent statements that would produce the user s current level of privilege. 11 Advanced MySQL Note The SHOW GRANTS statement was added in MySQL version if you have an earlier version this statement won t work. There are many other variations of the SHOW statement. A summary of all the variations is shown in Table . Table SHOW Statement Syntax Variation SHOW DATABASES LIKE database SHOW TABLES FROM database LIKE table Description Lists available databases optionally with names like database. Lists tables from the database currently in use or from the database called database if specified optionally with table names like table. Using MySQL 256 Part II Table Continued Variation Description SHOW COLUMNS FROM table FROM database LIKE column Lists all the columns in a particular table from the database currently in use or from the database specified optionally with column names like column. You might use SHOW FIELDS instead