Basic MySQL commands

MySQL-LogoHere I will describe some basic commands of MySQL. After login to the server console by SSH you can issue the below commands.

  • Loing to MySQL

  • List all MySQL databases on the system.

  • Change to some database when you first connect to MySQL.

  • List all tables from the current database or from the database given in the command.

  • Give a list of all columns (fields) from the given table, along with column type and other info.

  • List all indexes from this tables.

  • Table Commands

Creates a table with columns as indicated in the create clauses.

  • Remove the table from the database. Permanently! So be careful with this command!

  • Create a user without any privileges:

  • Delete a user:

  • View users:

  • Grants a user ALL privileges on ALL databases:

  • Give a user the privilege to grant other users access.

  • Give access to only one database called .example.?

  • Grant access ONLY to a table called .table1. in database .example”?

  • Allows the user to set his/her own password.

  • Flush All the MySQL Privileges (done after any modifications typically)

  • Exit the Interpreter

The following two tabs change content below.

Tapas Mishra

Sr. Engineer (DevOps)
Loves to work on Opensource products. Having experience on Linux environment. Knowledge on Public cloud services like AWS, Rackspace, DigitalOcean, Linode. Please don't hesitate to give a comment on the posts. Your comments are my strength.

Leave a Reply