<<Back to MySQL & MariaDB How To Page
How to create a user in MySQL or MariaDB
User CreationCREATE USER 'myuser' IDENTIFIED BY 'mypassword';
MariaDB [(none)]> CREATE USER 'test' IDENTIFIED BY 'test';
Query OK, 0 rows affected (0.00 sec)
Grant Full Permissions from Local Host
MariaDB [(none)]> GRANT USAGE ON *.* TO 'test'@'localhost' IDENTIFIED BY 'test';
Query OK, 0 rows affected (0.01 sec)
Grant Full Permissions from Any Computer
MariaDB [(none)]> GRANT USAGE ON *.* TO 'test'@'%' IDENTIFIED BY 'test';
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> GRANT ALL privileges ON `agi`.* TO 'test'@'%';
Query OK, 0 rows affected (0.05 sec)
Verify use right permissions
MariaDB [(none)]> show grants for 'test'@'%';
+-----------------------------------------------------------------------------------------------------+
| Grants for test@% |
+-----------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'test'@'%' IDENTIFIED BY PASSWORD '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29' |
| GRANT ALL PRIVILEGES ON `agi`.* TO 'test'@'%' |
+-----------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
+-----------------------------------------------------------------------------------------------------+
| Grants for test@% |
+-----------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'test'@'%' IDENTIFIED BY PASSWORD '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29' |
| GRANT ALL PRIVILEGES ON `agi`.* TO 'test'@'%' |
+-----------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
Comments
Post a Comment