I'm new in creating databases in MySQL. I've done creating tables in MySQL Workbench. Now I want to check the databases I've created using the MySQL Command Line Client. How should I do this? What should I type in the Command Line? Please help. Thanks.
Launch the MySQL Command-Line Client. To launch the client, enter the following command in a Command Prompt window: mysql -u root -p . The -p option is needed only if a root password is defined for MySQL. Enter the password when prompted.
MySQL client is a common name for tools that are designed to connect to MySQL Server. Client programs are used to send commands or queries to the server and allow managing data in the databases stored on the server.
MySQL Shell is an advanced command-line client and code editor for MySQL. In addition to SQL, MySQL Shell also offers scripting capabilities for JavaScript and Python. For information about using MySQL Shell, see MySQL Shell 8.0.
To see all databases:
show databases;
To switch to a specific database (note that the trailing ;
is optional here):
use databasename
To see the tables within the current database:
show tables;
To see the create table
statement for a specific table:
show create table tablename;
To see other misc info about a specific table:
describe tablename;
Additionally, all kinds of other interesting meta information is contained within the information_schema
database. You can use information_schema
and explore those tables for a wealth of information about your databases.
Another useful trick in the MySQL command line console is to terminate your queries with \G
instead of ;
. This causes output to be displayed all vertically rather than in a table, which is useful for tables that are wider than your screen display.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With