Creating New MariaDB Databases: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
(Created page with "[https://mariadb.com/kb/en/create-user/ Create a user]. <syntaxhighlight lang="mysql"> CREATE OR REPLACE USER 'user_name'@'host' IDENTIFIED BY 'password'; </syntaxhighlight> `Host` can be something like `'localhost'` or `'192.123.123.%'`. Put quotes around `user_name` and `host`, but not the @ symbol. Password is supplied as-is. Unencrypted and not passed through the `PASSWORD()` function.")
Tag: wikieditor
 
No edit summary
Tag: wikieditor
Line 1: Line 1:
[https://mariadb.com/kb/en/create-user/ Create a user].
== Create user ==
 
MariaDB [https://mariadb.com/kb/en/create-user/ User management] knowledge base. <ref>[https://mariadb.com/docs/ MariaDB Docs]</ref>


<syntaxhighlight lang="mysql">
<syntaxhighlight lang="mysql">
Line 5: Line 7:
</syntaxhighlight>
</syntaxhighlight>


`Host` can be something like `'localhost'` or `'192.123.123.%'`.  
`Host` can be something like `localhost` or `'192.123.123.0/24'`. <ref>[https://www.watchguard.com/help/docs/help-center/en-US/Content/en-US/Fireware/overview/networksecurity/slash_about_c.html About subnet mask slash notation]</ref>


Put quotes around `user_name` and `host`, but not the @ symbol.
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.
Password is supplied as-is. Unencrypted and not passed through the `PASSWORD()` function.
== Create database ==
<syntaxhighlight lang="mysql">
CREATE DATABASE IF NOT EXISTS example_database;
</syntaxhighlight>
== Grant user access to database ==
<syntaxhighlight lang="mysql">
GRANT ALTER TO example_database
TO 'user_name'@'192.123.123.0/24';
</syntaxhighlight>
== Reference ==
<references />

Revision as of 22:04, 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 TO example_database
TO 'user_name'@'192.123.123.0/24';

Reference