Payne's SQL Note #1

Back to Payne's SQL Notebook


Introduction and Terminology

PurposeSQL / Example
Create a new user CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; 
Delete a userDROP USER 'username'@'localhost';
Grant administer privilegesGRANT ALL ON *.* TO 'username'@'localhost';
Rename databaseCREATE DATABASE newDB;
RENAME TABLE oldDB.tableName TO newDB.tableName;
DROP DATABASE oldDB;
 Shell / Example
Export a MySQL databasemysqldump -u username -p database_name > file.sql
Import a MySQL databasemysql -u username -p database_name < file.sel