SQL: mysql common commands

# Connect as 'toxlab', prompt for a password (-p), and use the 'toxrefdb_3_0' database.
mysql -u toxlab -p toxrefdb_3_0
-- List all databases
SHOW DATABASES;

-- See which database you are currently using
SELECT DATABASE();

-- Switch current session to use a different database.
USE dbname;

-- Lists all user accounts and the hosts they can connect from. 
-- must have privileges on database to run this.
SELECT user, host FROM mysql.user;

-- Shows all the permissions (grants) for a specific user. 
SHOW GRANTS FOR 'user'@'host';	

-- List tables 
SHOW TABLES;

-- Get the structure of the 'studies' table
DESCRIBE studies;

-- Get the full CREATE statement for the 'studies' table
 SHOW CREATE TABLE studies\G


-- Note: Using \G instead of a semicolon (;) formats the output vertically

"I’ve got a rash, man."