
I am assuming your database is called `mydb` and your table is called `mytable`.
Creating a database with a UTF-8 character set
CREATE DATABASE `mydb` CHARACTER SET utf8 COLLATE utf8_general_ci;Show all databases
SHOW DATABASES;Dropping a database
DROP DATABASE `mydb`;Granting localhost privileges for a user on a database
GRANT ALL ON `mydb`.* TO `username`@localhost IDENTIFIED BY 'password'Select a database for querying
FLUSH PRIVILEGES;
USE `mydb`;Show the tables of a selected database
SHOW TABLES;Show column names of a table
SHOW COLUMNS FROM `mytable`;Drop a table
DROP TABLE `mytable`;Table sizes of a database
SELECT `mytable` AS "Tables", round(((data_length + index_length)/1024/1024),2)"Size in MB"Export a query into a csv file. Replace username, password, mydb and your query with your own data.
FROM information_schema.TABLES
WHERE table_schema = "mydb"
ORDERBY(data_length + index_length)DESC;
mysql -u USERNAME -pPASSWORD mydb -e "YOUR QUERY" | sed 's/\t/,/g' > /path/filename.csv