|
OS:CentOS Linux release 7.9.2009 (Core)
DB:8.4.2
查看当前用户信息权限:
mysql> select Host ,User,plugin,account_locked,password_expired,ssl_type from mysql.user;
+-----------+------------------+-----------------------+----------------+------------------+----------+
| Host | User | plugin | account_locked | password_expired | ssl_type |
+-----------+------------------+-----------------------+----------------+------------------+----------+
| % | root | mysql_native_password | N | N | |
| % | test | caching_sha2_password | N | N | ANY |
| % | wj | caching_sha2_password | N | N | ANY |
| localhost | mysql.infoschema | caching_sha2_password | Y | N | |
| localhost | mysql.session | mysql_native_password | Y | N | |
| localhost | mysql.sys | mysql_native_password | Y | N | |
+-----------+------------------+-----------------------+----------------+------------------+----------+
创建新用户:
mysql> CREATE USER 'lisa'@'localhost' IDENTIFIED BY 'lisa';
Query OK, 0 rows affected (0.02 sec)
查看lisa用户权限
mysql> select Host ,User,plugin,account_locked,password_expired,ssl_type,Select_priv,Insert_priv,Update_priv,Create_priv,password_expired from mysql.user where user='lisa';
+-----------+------+-----------------------+----------------+------------------+----------+-------------+-------------+-------------+-------------+------------------+
| Host | User | plugin | account_locked | password_expired | ssl_type | Select_priv | Insert_priv | Update_priv | Create_priv | password_expired |
+-----------+------+-----------------------+----------------+------------------+----------+-------------+-------------+-------------+-------------+------------------+
| localhost | lisa | caching_sha2_password | N | N | | N | N | N | N | N |
+-----------+------+-----------------------+----------------+------------------+----------+-------------+-------------+-------------+-------------+------------------+
1 row in set (0.00 sec)
但是是有本地登录权限
[root@sztech ~]# mysql -ulisa -plisa
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 8.4.2 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| performance_schema |
+--------------------+
2 rows in set (0.02 sec)
|
|