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'. |