OCI MDS mysql

安装mysql mysql-shell

在oracle linux8 下面安装 mysql mysql-shell

sudo yum install mysql-shell

sudo yum install mysql

mysql shell的下载地址

https://dev.mysql.com/downloads/shell

查询Mysql数据库的版本:

SELECT VERSION();

查询变量用户的认证模式:

show variables like 'default_authentication_plugin';
SELECT user, plugin FROM mysql.user where user='admin'
CREATE USER 'felix'@'%' IDENTIFIED WITH 'mysql_native_password' BY 'Felix_123456';
CREATE USER 'felix'@'%' IDENTIFIED BY 'Felix_123456';
修改用户的认证插件:
ALTER USER 'felix'@'%' IDENTIFIED WITH 'caching_sha2_password' BY 'Felix_123456';

list user info :
select user,host,plugin from mysql.user where user ='admin';
modify the password of the admin user:
ALTER USER 'admin'@'%' IDENTIFIED BY 'Felix_123456';

对于权限更改,OCI MDS 通常会自动应用这些更改,而不需要显式地运行 FLUSH PRIVILEGES;
当你使用 MDS 的管理界面或 API 来更改用户权限时,这些更改应该立即生效,无需手动刷新。

下载OCI MDS binlog日志

查询binlog的时间

show variables like 'binlog_expire_logs_seconds';

调整binlog的过期时间
binlog_expire_logs_seconds 这个参数默认是3600,即1个小时,可以调整为604800(7天)

下载binlog
mysqlbinlog –read-from-remote-server –raw -utrnuser -hxxx -P3306 -pxxx binary-log.021253

查看binlog
mysqlbinlog -v –base64-output=decode-rows binary-log.021253 > /tmp/binary-log.021253.txt

  • 先通过show binary logs;看看当前的binlog
  • 下载对应的binlog
    mysqlbinlog –read-from-remote-server –raw -uxxx -hxxx -P3306 -pxxx binary-log.021253
  • 使用 mysqlbinlog 进行解析
    mysqlbinlog -v –base64-output=decode-rows binary-log.021253 > /tmp/binary-log.021253.txt

全局变量event_scheduler

event_scheduler这变量默认是ON的状态。如果在下面查询中返回空,就代表没有schedued event。
SELECT * FROM information_schema.events;

用户的权限


SELECT user,super_priv FROM mysql.user  WHERE user = 'admin' AND (super_priv = 'N' );
select user, host, plugin from mysql.user;
SELECT user FROM mysql.user WHERE super_priv = 'Y';

Reference Link

https://medium.com/@hiteshgondalia/oci-mds-cloud-economics-say-hello-to-heatwave-3d6ef855bcef

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *