字段加密
单向
SELECT MD5('hello'); SELECT PASSWORD('hello'); SELECT SHA1('hello'); 双向 SELECT encode('hello', '123'); SELECT decode(encode('hello','123'),'123'); SELECT TO_BASE64(AES_ENCRYPT('hello','xuehui')); SELECT AES_DECRYPT(FROM_BASE64('+VGh/5D/mwiDqfl9krcUJw=='),'xuehui'); 表空间加密 1 mysql配置文件-keyring加密插件 plugin_dir keyring_file_data innodb_file_per_table=1 # 只作用于独立表空间 2 重启MySQL 3 查看插件状态 show plugins; 4 创建加密的新表 alter table test1 encryption=’Y’; alter table test1 encryption=’N’; 5.统计表空间加密的表 SELECT TABLE_SCHEMA, TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='testdb2' and CREATE_OPTIONS='ENCRYPTION="Y"'; 6 备份keyring文件