NOTES
Basic MySQL admin statements
-- Lists the databases SHOW DATABASES; -- Creates a database with the given name CREATE DATABASE IF NOT EXISTS database CHARACTER SET utf8; -- Deletes the database DROP DATABASE IF EXISTS database; -- Create new MySQL account CREATE USER IF NOT EXISTS 'user'@'localhost' IDENTIFIED BY 'password'; -- Remove MySQL account DROP USER IF EXISTS 'user'@'localhost'; -- Assign privileges to MySQL user account GRANT ALL ON database.* TO 'user'@'localhost'; -- Revoke privileges from user account REVOKE ALL ON database.* FROM 'user'@'localhost'; -- Modifies MySQL accounts ALTER USER 'user'@'localhost' IDENTIFIED BY 'new_password'; -- Create table with name CREATE TABLE IF NOT EXISTS `table` ( id INT AUTO_INCREMENT, integer_number INT, fractional_number FLOAT, large_string LONGBLOB, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- Remove table with name DROP TABLE IF EXISTS `table`;
Older Post
Home