Basic MySQL Database and Table Commands in SSH - MySQL
There are some hosting companies that do not offer an SSL (Secure Socket Layer) environment for MySQL. It is important to have an SSL environment for MySQL, because your sessions are protected with “encryption.” Fortunately, if you can't get SSL with your hosting company, there is an alternative: SSH.
After logging in, below you will find the important commands that you should know (bolded words are the exact commands, while the part that is not bolded is the MySQL prompt):
1. Showing all MySQL databases in your server
mysql> show databases;
2. Access the database and use it:
mysql> use databasename;
For example, if your MySQL database name is moviedatabase then:
mysql> use moviedatabase;
3. Showing all the MySQL tables for the specified database name:
mysql> show tables from databasename;
4. Show all of the records from a specified table
mysql> select * from databasetablename;
To view the entire records of a specified table, you should ensure that:
You have selected the database to work using USE command.
You know the exact database table name; if not, execute the "SHOW TABLES from databasename;" command to get the list of tables.
5. Show all of the database table field names, type and configuration of a certain table:
mysql> describe databasetablename;
Before you try to view database table specifics like its configuration, make sure that you have selected a database using the USE command.