Basic SQL Commands

DB Management

Show Databases

Create Database

Example:

Select a Database

Example:

Drop/Delete Database

Warning: This will delete the database and there is no way to restore it.

Table Management

Show Tables

Create Table

Show Table Fields

Drop/Delete Table

Warning: This will delete the table and there is no way to restore it.

User Management

Show Users

Show users with the access host and password:

Add User

Example: (This will allow the user to change ALL tables on the cmsdatabase database.) Please note that if you need your user to be able to give permissions to other DB users you can add WITH GRANT OPTION in the end of the command before the ; . This can be a security issue.

Drop/Delete a User

Example:

Change Users Password

Change a users password:

Update Privileges

After changing privileges for a database or global user do NOT restart the database service instead you will need to do this:

Import/Export

Import Database

Import a dump of an SQL:

Export Database

Create a dump (backup) of a Database: