# Database: MySQL: Commands

## Web/GUI interface to MySQL

The most common way to manage MySQL databases is by using a program like PHPMyAdmin, which is probably the most popular way to manage MySQL databases that are used to support Web servers. There is also a GUI front end.

## Command line interface

These commands can be entered from the command line after the MySQL server has been started, and after the MySQL command line interpreter has been started. See MySQL.

## MySQL text commands in addition to standard SQL commands

Commands end with semi-colon, cancel a command with \c.

SELECT command
`SELECT` | `VERSION();` | To display MySQL version.
`SELECT` | `USER();` | To display current user.
`SELECT` | `NOW();` | Shows server time.
`SELECT` | `DATABASE();` | Shows current database.
Useful Admin Commands
`QUIT` |  | To quit interation with `mysql` command interpreter.
`CREATE` | `DATABASE dbname;` | Creates a database.
`GRANT` | `ALL ON dbname.* TO user;` | Gives permission.
`USE` | `dbname` | Subsequent commands use dbname.
Working with a database
`DESCRIBE` | `tablename;` | Displays table field names and types.
`LOAD` | `DATA LOCAL INFILE 'filepath' INTO TABLE tablename;` | Reads tab-separated rows of values into table. Can change separator.
SHOW command
`SHOW` | `DATABASES;` | To see which databases are available.
`SHOW` | `TABLES;` | Displays tables in current database.
SET command
`SET` | `PASSWORD = PASSWORD('new pw');`; | Sets current user's password to 'new pw'.
`SET` | `PASSWORD FOR user = PASSWORD('new pw');`; | Sets user's password to 'new pw'.