From 39721c248dea1290688c1a7e2f8cd19380e5a531 Mon Sep 17 00:00:00 2001 From: liupopo Date: Fri, 2 Jun 2023 17:59:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/databases/database_create.sql | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/docs/databases/database_create.sql b/docs/databases/database_create.sql index 976a2fe..ea17eaa 100644 --- a/docs/databases/database_create.sql +++ b/docs/databases/database_create.sql @@ -1,2 +1,47 @@ CREATE DATABASE `yxt_supervise_monitor` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */ + +grant select,insert,update,delete on yxt_supervise_monitor.* to monitor@"%" Identified by "monitor"; +grant all privileges on *.* to 'yangxin'@'%' identified by 'yangxin123456' with grant option; + +grant all privileges on yxt_supervise_monitor.* to 'monitor'@'%' identified by 'monitor' with grant option; + +39.104.100.138 +monitor +monitor + +create user 'monitor'@'%' identified by 'monitor'; +grant all privileges on yxt_supervise_monitor.* to 'monitor'@'%' with grant option; +flush privileges; +在 JDBC 连接串中加入 allowPublicKeyRetrieval=true 参数; + + +MySql8有新的安全要求,不能像之前的版本那样一次性创建用户并授权需要先创建用户,再进行授权操作 + +1. 创建新用户: + + create user 'username'@'host' identified by 'password'; + +1 +其中username为自定义的用户名;host为登录域名,host为'%'时表示为 任意IP,为localhost时表示本机,或者填写指定的IP地址;paasword为密码 + +2. 为用户授权: + + grant all privileges on *.* to 'username'@'%' with grant option; +1 +其中*.*第一个*表示所有数据库,第二个*表示所有数据表,如果不想授权全部那就把对应的*写成相应数据库或者数据表;username为指定的用户;%为该用户登录的域名 + +3. 授权之后刷新权限: + + flush privileges; +1 +4.撤销授权 + +#收回权限(不包含赋权权限) +REVOKE ALL PRIVILEGES ON *.* FROM user_name; +REVOKE ALL PRIVILEGES ON user_name.* FROM user_name; +#收回赋权权限 +REVOKE GRANT OPTION ON *.* FROM user_name; + +#操作完后重新刷新权限 +flush privileges; \ No newline at end of file