Creating New MariaDB Databases: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
No edit summary
Tag: wikieditor
Tag: wikieditor
Line 22: Line 22:


<syntaxhighlight lang="mysql">
<syntaxhighlight lang="mysql">
GRANT ALTER TO example_database
GRANT ALTER ON example_database
TO 'user_name'@'192.123.123.0/24';
TO 'user_name'@'192.123.123.0/24';
</syntaxhighlight>
</syntaxhighlight>

Revision as of 22:06, 4 March 2024

Create user

MariaDB User management knowledge base. [1]

CREATE OR REPLACE USER 'user_name'@'host' IDENTIFIED BY 'password';

Host can be something like localhost or '192.123.123.0/24'. [2]

IP addresses need to be surrounded by quotes. Put the user name in quotes and the host in quotes, but not the @ symbol.

Password is supplied as-is. Unencrypted and not passed through the PASSWORD() function.

Create database

CREATE DATABASE IF NOT EXISTS example_database;

Grant user access to database

GRANT ALTER ON example_database
TO 'user_name'@'192.123.123.0/24';

Reference