MySQL DDL Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 14: Line 14:
CREATE USER 'someuser'@'localhost' IDENTIFIED BY 'somepassword';
CREATE USER 'someuser'@'localhost' IDENTIFIED BY 'somepassword';
</syntaxhighlight>
</syntaxhighlight>
==Grant to User All Privileges on a Database==
<syntaxhighlight lang='sql'>
GRANT ALL PRIVILEGES ON some_database.* TO 'someuser'@'localhost';
FLUSH PRIVILEGES;
</syntaxhighlight>
==Delete User==
==Delete User==
<syntaxhighlight lang='sql'>
<syntaxhighlight lang='sql'>

Revision as of 03:56, 30 March 2021

Internal

Server Version

SELECT VERSION();

Users

Display Users

SELECT USER FROM mysql.user;

Create User

CREATE USER 'someuser'@'localhost' IDENTIFIED BY 'somepassword';

Grant to User All Privileges on a Database

GRANT ALL PRIVILEGES ON some_database.* TO 'someuser'@'localhost';
FLUSH PRIVILEGES;

Delete User

Database

Display Databases

SHOW DATABASES;

Create Database

CREATE DATABASE some_database;

Delete Database