Create User - mysql

时间:2023-03-24 13:49:44

Create User

MariaDB [(none)]> CREATE USER 'DBAdmin'@'%' IDENTIFIED BY 'mypasswd';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> CREATE USER 'tdtc2014'@'localhost' IDENTIFIED BY 'qazxsw';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'DBAdmin'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT SELECT,INSERT,UPDATE,DELETE ON carnumber.* TO 'tdtc2014'@'localhost';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show grants for 'DBAdmin';
+-----------------------------------------------------------------------------------------------------------------------------------+
| Grants for DBAdmin@%                                                                                                              |
+-----------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'DBAdmin'@'%' IDENTIFIED BY PASSWORD '*8640888BFB179C50EF0B4DE12251E66B4FB18A77' WITH GRANT OPTION |
+-----------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

MariaDB [(none)]> \q
Bye