Display available databases
Display all tables in a database
Display tables along with number of columns in a database
Display total number of columns and rows of all tables in a database
Display all columns of a table
Display details about a specific column from a table
In all the following mysqlshow examples, you can provide password using one of the following two methods:
Enter the password immediately after -p in the mysqlshow command without any space after -p. This option is helpful, if you are using mysqlshow inside a shell script.
Just provide option -p without any password to mysqlshow, which will prompt for a password. This option is recommended when you are using mysqlshow interactively from the command line.
- Display available databases Please replace tmppassword with your MySQL DB root user password.
# mysqlshow -u root -ptmppassword
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
| sugarcrm |
+--------------------+
- Display all tables in a database The example below will display all the tables located under sugarcrm database
# mysqlshow -u root -ptmppassword sugarcrm
Database: sugarcrm
+--------------------------------+
| Tables |
+--------------------------------+
| accounts |
| accounts_audit |
| accounts_bugs |
- Display tables along with number of columns in a database
# mysqlshow -v -u root -p sugarcrm
Enter password:
Database: sugarcrm
+--------------------------------+----------+
| Tables | Columns |
+--------------------------------+----------+
| accounts | 33 |
| accounts_audit | 10 |
| accounts_bugs | 5 |
- Display total number of columns and rows of all tables in a database Please note there are two -v in the following command.
# mysqlshow -v -v -u root -p sugarcrm
Enter password:
Database: sugarcrm
+--------------------------------+----------+------------+
| Tables | Columns | Total Rows |
+--------------------------------+----------+------------+
| accounts | 33 | 252 |
| accounts_audit | 10 | 63 |
| accounts_bugs | 5 | 0 |
- Display all columns of a table In the following example, it displays all the available column name along with additional column information for accounts table in sugarcrm database.
# mysqlshow -u root -ptmppassword sugarcrm accounts
Database: sugarcrm Table: accounts
+-----------------------------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-----------------------------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
| id | char(36) | utf8_general_ci | NO | PRI | | | select,insert,update,references | |
| name | varchar(150) | utf8_general_ci | YES | | | | select,insert,update,references | |
| date_entered | datetime | | YES | | | | select,insert,update,references | |
- Display details about a specific column from a table In this example, it displays information about id column from accounts table.
Latest comments (0)