SQL Server 2005 镜像 高可用性模式 (证书认证) 一、为主体 数据库 配置 出站连接 --创建 数据库 主密钥 CREATE MASTER KEY ENCRYPTION BY PASSWORD = '111111'; GO --在MIR-A上为 数据库 实例创建证书 USE master; CREATE CERTIFICATE MIR_A_cert WITH SU
SQL Server 2005镜像高可用性模式
(证书认证)
一、为主体数据库配置出站连接 --创建数据库主密钥 CREATE MASTER KEY ENCRYPTION BY PASSWORD = '111111'; GO
USE master; CREATE CERTIFICATE MIR_A_cert WITH SUBJECT = 'MIR_A certificate', START_DATE = '01/27/2008', EXPIRY_DATE = '01/01/2099' GO
CREATE ENDPOINT Endpoint_Mirroring STATE = STARTED AS TCP ( LISTENER_PORT=5024 , LISTENER_IP = ALL ) FOR DATABASE_MIRRORING ( AUTHENTICATION = CERTIFICATE MIR_A_cert , ENCRYPTION = REQUIRED ALGORITHM RC4 , ROLE = ALL ); GO --备份MIR-A上的证书并拷贝到MIR-B,MIR-W上 BACKUP CERTIFICATE MIR_A_cert TO FILE = 'C:\MIR_A_cert.cer'; GO
USE master; CREATE MASTER KEY ENCRYPTION BY PASSWORD = '111111'; GO --在MIR-B上为数据库实例创建证书 CREATE CERTIFICATE MIR_B_cert WITH SUBJECT = 'MIR_B certificate for database mirroring', START_DATE = '01/27/2008', EXPIRY_DATE = '01/01/2099'; GO --在MIR-B上使用上面创建的证书为数据库实例创建镜像端点 CREATE ENDPOINT Endpoint_Mirroring STATE = STARTED AS TCP ( LISTENER_PORT=5024, LISTENER_IP = ALL ) FOR DATABASE_MIRRORING ( AUTHENTICATION = CERTIFICATE MIR_B_cert, ENCRYPTION = REQUIRED ALGORITHM RC4, ROLE = ALL ); GO --备份MIR-B上的证书并拷贝到MIR-A,MIR-W上 BACKUP CERTIFICATE MIR_B_cert TO FILE = 'C:\MIR_B_cert.cer'; GO
USE master; CREATE MASTER KEY ENCRYPTION BY PASSWORD = '111111'; GO --在MIR-W上为数据库实例创建证书 CREATE CERTIFICATE MIR_W_cert WITH SUBJECT = 'MIR_W certificate for database mirroring', START_DATE = '01/27/2008', EXPIRY_DATE = '01/01/2099'; GO --在MIR-W上使用上面创建的证书为数据库实例创建镜像端点 CREATE ENDPOINT Endpoint_Mirroring STATE = STARTED AS TCP ( LISTENER_PORT=5024, LISTENER_IP = ALL ) FOR DATABASE_MIRRORING ( AUTHENTICATION = CERTIFICATE MIR_W_cert, ENCRYPTION = REQUIRED ALGORITHM RC4, ROLE = ALL ); GO --备份MIR-W上的证书并拷贝到MIR-A,MIR-B上 BACKUP CERTIFICATE MIR_W_cert TO FILE = 'C:\MIR_W_cert.cer'; GO
USE master; CREATE LOGIN MIR_B_login WITH PASSWORD = '111111'; GO --为以上登陆创建一个用户 CREATE USER MIR_B_user FOR LOGIN MIR_B_login; GO --绑定证书到用户 CREATE CERTIFICATE MIR_B_cert AUTHORIZATION MIR_B_user FROM FILE = 'C:\MIR_B_cert.cer' GO --在镜像端点上为登陆赋予CONNECT权限 GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [MIR_B_login]; GO
USE master; CREATE LOGIN MIR_W_login WITH PASSWORD = '111111'; GO --为以上登陆创建一个用户 CREATE USER MIR_W_user FOR LOGIN MIR_W_login; GO --绑定证书到用户 CREATE CERTIFICATE MIR_W_cert AUTHORIZATION MIR_W_user FROM FILE = 'C:\MIR_W_cert.cer' GO --在镜像端点上为登陆赋予CONNECT权限 GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [MIR_W_login]; GO
USE master; CREATE LOGIN MIR_A_login WITH PASSWORD = '111111'; GO --为以上登陆创建一个用户 CREATE USER MIR_A_user FOR LOGIN MIR_A_login; GO --绑定证书到用户 CREATE CERTIFICATE MIR_A_cert AUTHORIZATION MIR_A_user FROM FILE = 'C:\MIR_A_cert.cer' GO --在镜像端点上为登陆赋予CONNECT权限 GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [MIR_A_login]; GO
USE master; CREATE LOGIN MIR_W_login WITH PASSWORD = '111111'; GO --为以上登陆创建一个用户 CREATE USER MIR_W_user FOR LOGIN MIR_W_login; GO --绑定证书到用户 CREATE CERTIFICATE MIR_W_cert AUTHORIZATION MIR_W_user FROM FILE = 'C:\MIR_W_cert.cer' GO --在镜像端点上为登陆赋予CONNECT权限 GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [MIR_W_login]; GO
六、为见证数据库配置入站连接
--在MIR-W上为MIR-A创建登陆 USE master; CREATE LOGIN MIR_A_login WITH PASSWORD = '111111'; GO --为以上登陆创建一个用户 CREATE USER MIR_A_user FOR LOGIN MIR_A_login; GO --绑定证书到用户 CREATE CERTIFICATE MIR_A_cert AUTHORIZATION MIR_A_user FROM FILE = 'C:\MIR_A_cert.cer' GO --在镜像端点上为登陆赋予CONNECT权限 GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [MIR_A_login]; GO
USE master; CREATE LOGIN MIR_B_login WITH PASSWORD = '111111'; GO --为以上登陆创建一个用户 CREATE USER MIR_B_user FOR LOGIN MIR_B_login; GO --绑定证书到用户 CREATE CERTIFICATE MIR_B_cert AUTHORIZATION MIR_B_user FROM FILE = 'C:\MIR_B_cert.cer' GO --在镜像端点上为登陆赋予CONNECT权限 GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [MIR_B_login]; GO
七、在MIR-A上备份数据库
--修改Northwind数据库使用完整恢复模式 ALTER DATABASE Northwind SET RECOVERY FULL; GO --在 MIR_A 的主体服务器实例上备份数据库 --通过安全方法,将 C:\Northwind.bak 复制到MIR_B上 USE Northwind BACKUP DATABASE Northwind TO DISK = 'C:\Northwind.bak' WITH FORMAT GO
八、转到MIR-B上去恢复数据库
--在MIR-B的镜像服务器实例上还原数据库: RESTORE DATABASE Northwind FROM DISK = 'C:\Northwind.bak' WITH NORECOVERY GO
九、为镜像数据库配置镜像伙伴
--在 MIR-B 的镜像服务器实例上,将 MIR-A 上的服务器实例设置为伙伴 ALTER DATABASE Northwind SET PARTNER = 'TCP://MIR-A:5024'; GO
十、为主体数据库配置镜像伙伴和见证服务器
--在 MIR-A 的主体服务器实例上,将MIR-B上的服务器实例设置为伙伴 ALTER DATABASE Northwind SET PARTNER = 'TCP://MIR-B:5024'; GO --在 MIR-A 的主体服务器实例上,将 MIR-W 上的服务器实例设置为见证服务器 ALTER DATABASE Northwind SET WITNESS = 'TCP://MIR-W:5024'; GO
十一、配置数据库镜像事务安全级别
ALTER DATABASE Northwind SET SAFETY FULL GO 十二、分别在MIR-A和MIR-B上查看数据库镜像的配置状态
-- 1.)通过Management studio 对象资源管理器,查看主体数据库、镜像数据库状态 -- 2.)通过Management studio 对象资源管理器中的数据库属性查看状态 -- 3.)通过系统目录视图查看数据库镜像配置情况
GO SELECT * FROM sys.database_mirroring_endpoints; GO SELECT * FROM sys.database_mirroring WHERE database_id = (SELECT database_id FROM sys.databases WHERE name = 'Northwind') GO
|

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

ToaddusersinMySQLeffectivelyandsecurely,followthesesteps:1)UsetheCREATEUSERstatementtoaddanewuser,specifyingthehostandastrongpassword.2)GrantnecessaryprivilegesusingtheGRANTstatement,adheringtotheprincipleofleastprivilege.3)Implementsecuritymeasuresl

ToaddanewuserwithcomplexpermissionsinMySQL,followthesesteps:1)CreatetheuserwithCREATEUSER'newuser'@'localhost'IDENTIFIEDBY'password';.2)Grantreadaccesstoalltablesin'mydatabase'withGRANTSELECTONmydatabase.TO'newuser'@'localhost';.3)Grantwriteaccessto'

The string data types in MySQL include CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and TEXT. The collations determine the comparison and sorting of strings. 1.CHAR is suitable for fixed-length strings, VARCHAR is suitable for variable-length strings. 2.BINARY and VARBINARY are used for binary data, and BLOB and TEXT are used for large object data. 3. Sorting rules such as utf8mb4_unicode_ci ignores upper and lower case and is suitable for user names; utf8mb4_bin is case sensitive and is suitable for fields that require precise comparison.

The best MySQLVARCHAR column length selection should be based on data analysis, consider future growth, evaluate performance impacts, and character set requirements. 1) Analyze the data to determine typical lengths; 2) Reserve future expansion space; 3) Pay attention to the impact of large lengths on performance; 4) Consider the impact of character sets on storage. Through these steps, the efficiency and scalability of the database can be optimized.

MySQLBLOBshavelimits:TINYBLOB(255bytes),BLOB(65,535bytes),MEDIUMBLOB(16,777,215bytes),andLONGBLOB(4,294,967,295bytes).TouseBLOBseffectively:1)ConsiderperformanceimpactsandstorelargeBLOBsexternally;2)Managebackupsandreplicationcarefully;3)Usepathsinst

The best tools and technologies for automating the creation of users in MySQL include: 1. MySQLWorkbench, suitable for small to medium-sized environments, easy to use but high resource consumption; 2. Ansible, suitable for multi-server environments, simple but steep learning curve; 3. Custom Python scripts, flexible but need to ensure script security; 4. Puppet and Chef, suitable for large-scale environments, complex but scalable. Scale, learning curve and integration needs should be considered when choosing.

Yes,youcansearchinsideaBLOBinMySQLusingspecifictechniques.1)ConverttheBLOBtoaUTF-8stringwithCONVERTfunctionandsearchusingLIKE.2)ForcompressedBLOBs,useUNCOMPRESSbeforeconversion.3)Considerperformanceimpactsanddataencoding.4)Forcomplexdata,externalproc


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Linux new version
SublimeText3 Linux latest version
