第 49 章 Database Administration

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介:

目录

49.1. User Account Management
49.1.1. Create User
49.1.2. Drop User
49.1.3. Rename User
49.1.4. SET PASSWORD
49.2. Access Privilege System
49.2.1. SHOW GRANTS
49.2.2. show privileges
49.2.3. Grant privileges
49.2.4. Revoke privileges
49.2.5. Show Privileges
49.2.6. MAX_QUERIES_PER_HOUR/MAX_UPDATES_PER_HOUR
49.2.7. Table Privileges
49.2.8. Column Privileges
49.3. Maintenance 数据库维护
49.3.1. CHECK 检查表
49.3.2. ANALYZE 分析表
49.3.3. CHECKSUM
49.3.4. OPTIMIZE 优化表
49.3.5. REPAIR 修复
49.4. INFORMATION_SCHEMA
49.4.1. 查询表字段
49.4.2. 列出所有触发器
49.5. Backup and Recovery
49.5.1. Import / Export
49.5.1.1. Export(Backup)
49.5.1.2. Import(Recovery)
49.5.1.3. xml
49.5.1.4. 备份表数据
49.5.1.5. source
49.5.1.6. 使用 mysqlhotcopy 备份 MyISAM 引擎的数据库
49.5.1.7. AutoMySQLBackup
49.5.1.8. xtrabackup - Open source backup tool for InnoDB and XtraDB.
49.5.1.8.1. Percona yum Repository
49.5.1.8.2. Creating an Incremental Backup
49.5.2. Snapshot Backup
49.5.2.1. LVM Snapshot
49.5.2.2. Btrfs Snapshot

49.1. User Account Management

49.1.1. Create User

CREATE USER user [IDENTIFIED BY [PASSWORD] 'password']
    [, user [IDENTIFIED BY [PASSWORD] 'password']] ...
			
CREATE USER 'test'@'xxx.xxx.xxx.xxx' IDENTIFIED BY  'your_password';
			
CREATE USER 'root'@'192.168.1.%' IDENTIFIED BY 'password';
			

add a new user by grant

			
GRANT ALL PRIVILEGES ON opencart.* TO 'neo'@'localhost' IDENTIFIED BY 'chen' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON *.* TO 'neo'@'localhost' IDENTIFIED BY 'chen' WITH GRANT OPTION;

FLUSH PRIVILEGES;
			
			

49.1.2. Drop User

DROP USER user [, user] ...
			
			
mysql> drop user admin@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> drop user admin@'127.0.0.1';
Query OK, 0 rows affected (0.00 sec)
			
			

49.1.3. Rename User

RENAME USER old_user TO new_user [, old_user TO new_user] ...
			

49.1.4. SET PASSWORD

mysql 5.7 之前的版本

SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');

SET PASSWORD FOR 'root'@'%' = PASSWORD('co2uqAMAho1aSOS62146Xoci6ogu4I');
			

MySQL 5.7

ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_password';		
			





原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
打赏
0
0
0
0
26199
分享
相关文章
WARNING: Too Many Parse Errors With error=911 When Running a JDBC Application Connected to an Oracle 19c database
WARNING: Too Many Parse Errors With error=911 When Running a JDBC Application Connected to an Oracle 19c database (
145 2
19c 开启Oracle Database Vault
19c 开启Oracle Database Vault
206 1
Connect to Autonomous Database Using Oracle Database Tools
Connect to Autonomous Database Using Oracle Database Tools
96 1
Requirements for Installing Oracle Database/Client 19c on OL8 or RHEL8 64-bit (x86-64) (Doc ID 2668780.1)
Requirements for Installing Oracle Database/Client 19c on OL8 or RHEL8 64-bit (x86-64) (Doc ID 2668780.1)
100 0
|
11月前
|
Oracle Database Vault Access Control Components
Oracle Database Vault Access Control Components
79 0
What Is Oracle Database Vault?
The Oracle Database Vault security controls protect application data from unauthorized access, and helps you to comply with privacy and regulatory requirements. You can deploy controls to block privileged account access to application data and control sensitive operations inside the database using
62 0
服务器Centos7 静默安装Oracle Database 12.2
服务器Centos7 静默安装Oracle Database 12.2
417 0

热门文章

最新文章