MySQL / MariaDB - Create Database User with Password

event 2020-12-28 visibility 445 comment 0 insights
more_vert
insights Stats
Raymond Raymond Code Snippets & Tips

Code snippets and tips for various programming languages/frameworks. All code examples are under MIT or Apache 2.0 license unless specified otherwise. 

This code snippet shows you how to create a database user with password in MySQL or MariaDB.

Code snippet

The following code snippet creates a user named 'hive' with password ('hive') that never expires.

CREATE USER 'hive'@'localhost' IDENTIFIED BY 'hive' password expire never;

Grant permissions

The following SQL statement grants all permission to user 'hive':

GRANT ALL ON *.* TO 'hive'@'localhost';
More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts