mysql to sql server_正在连接到 SQL Server (MySQLToSQL) - SQL Server | Microsoft Docs

连接到 SQL Server (MySQLToSQL)Connecting to SQL Server (MySQLToSQL)

11/16/2020

本文内容

若要将 MySQL 数据库迁移到 SQL ServerSQL Server ,你必须连接到的目标实例 SQL ServerSQL Server 。To migrate MySQL databases to SQL ServerSQL Server, you must connect to the target instance of the SQL ServerSQL Server. 在连接时,SSMA 将获取实例中所有数据库的元数据, SQL ServerSQL Server 并在 SQL Server 元数据资源管理器 中显示数据库元数据。When you connect, SSMA obtains metadata about all the databases in the instance of SQL ServerSQL Server and displays database metadata in the SQL Server Metadata Explorer. SSMA 存储已连接到的实例的信息 SQL ServerSQL Server ,但不存储密码。SSMA stores information of the instance of SQL ServerSQL Server you are connected to, but does not store passwords.

你的连接将 SQL ServerSQL Server 保持活动状态,直到你关闭项目。Your connection to SQL ServerSQL Server stays active until you close the project. 重新打开项目时, SQL ServerSQL Server 如果想要与服务器建立活动连接,则必须重新连接到。When you reopen the project, you must reconnect to SQL ServerSQL Server if you want an active connection to the server. 在将数据库对象加载到和迁移数据之前,可以脱机工作 SQL ServerSQL Server 。You can work offline until you load database objects into SQL ServerSQL Server and migrate data.

有关实例的元数据 SQL ServerSQL Server 不会自动同步。Metadata about the instance of SQL ServerSQL Server is not automatically synchronized. 相反,若要更新 SQL Server 元数据资源管理器 中的元数据,必须手动更新 SQL ServerSQL Server 元数据。Instead, to update the metadata in SQL Server Metadata Explorer, you must manually update the SQL ServerSQL Server metadata. 有关详细信息,请参阅本主题后面的 "同步 SQL Server 元数据" 一节。For more information, see the "Synchronizing SQL Server Metadata" section later in this topic.

必需的 SQL Server 权限Required SQL Server Permissions

用于连接到的帐户 SQL ServerSQL Server 需要不同的权限,具体取决于帐户执行的操作:The account that is used to connect to SQL ServerSQL Server requires different permissions depending on the actions that the account performs:

若要将 MySQL 对象转换为 Transact-SQLTransact-SQL 语法、更新中的元数据 SQL ServerSQL Server 或将转换后的语法保存到脚本中,该帐户必须有权登录到的实例 SQL ServerSQL Server 。To convert MySQL objects to Transact-SQLTransact-SQL syntax, to update metadata from SQL ServerSQL Server, or to save converted syntax to scripts, the account must have permission to log on to the instance of SQL ServerSQL Server.

若要将数据库对象加载到 SQL ServerSQL Server 中,该帐户必须是 db_ddladmin 数据库角色的成员。To load database objects into SQL ServerSQL Server, the account must be a member of the db_ddladmin database role.

若要将数据迁移到 SQL ServerSQL Server ,帐户必须:To migrate data to SQL ServerSQL Server, the account must be:

如果使用客户端数据迁移引擎,则为 db_owner 数据库角色的成员。A member of the db_owner database role, if using client-side data migration engine.

Sysadmin 服务器角色的成员(如果使用服务器端数据迁移引擎)。A member of the sysadmin server role, if using server-side data migration engine. 这是 CmdExec SQL ServerSQL Server 在数据迁移过程中创建代理作业步骤以运行 SSMA 大容量复制工具所必需的。This is required to create the CmdExec SQL ServerSQL Server Agent job step during data migration to run SSMA bulk copy tool.

备注

SQL ServerSQL Server 服务器端数据迁移不支持代理的代理帐户。Agent proxy accounts are not supported by the server-side data migration.

建立 SQL Server 连接Establishing a SQL Server Connection

在将 MySQL 数据库对象转换为 SQL ServerSQL Server 语法之前,必须建立与 SQL ServerSQL Server 要迁移 MySQL 数据库的实例的连接。Before you convert MySQL database objects to SQL ServerSQL Server syntax, you must establish a connection to the instance of SQL ServerSQL Server where you want to migrate the MySQL database or databases.

定义连接属性时,还可以指定要将对象和数据迁移到的数据库。When you define the connection properties, you also specify the database where objects and data will be migrated. 在连接到之后,你可以在 MySQL 架构级别自定义此映射 SQL ServerSQL Server 。You can customize this mapping at the MySQL schema level after you connect to SQL ServerSQL Server.

重要

尝试连接到之前,请 SQL ServerSQL Server 确保的实例 SQL ServerSQL Server 正在运行,并且可以接受连接。Before you try to connect to SQL ServerSQL Server, make sure that the instance of SQL ServerSQL Server is running and can accept connections.

若要连接到 SQL Server:To connect to SQL Server:

在 " 文件 " 菜单上,选择 " 连接到 SQL Server (在创建项目) 后启用此选项。On the File menu, select Connect to SQL Server (this option is enabled after the creation of a project).

如果以前已连接到 SQL ServerSQL Server ,则命令名称将 重新连接到 SQL Server。If you have previously connected to SQL ServerSQL Server, the command name will be Reconnect to SQL Server.

在 "连接" 对话框中,输入或选择实例的名称 SQL ServerSQL Server 。In the connection dialog box, enter or select the name of the instance of SQL ServerSQL Server.

如果要连接到本地计算机上的默认实例,则可以输入 localhost 或 .) (。If you are connecting to the default instance on the local computer, you can enter localhost or a dot (.).

如果要连接到另一台计算机上的默认实例,请输入计算机的名称。If you are connecting to the default instance on another computer, enter the name of the computer.

如果要连接到另一台计算机上的命名实例,请输入计算机名称后跟反斜杠和实例名称,如 MyServer\MyInstance 。If you are connecting to a named instance on another computer, enter the computer name followed by a backslash and then the instance name, such as MyServer\MyInstance.

如果实例 SQL ServerSQL Server 配置为接受非默认端口上的连接,请 SQL ServerSQL Server 在 " 服务器端口 " 框中输入用于连接的端口号。If your instance of SQL ServerSQL Server is configured to accept connections on a non-default port, enter the port number that is used for SQL ServerSQL Server connections in the Server port box. 对于的默认实例 SQL ServerSQL Server ,默认端口号为1433。For the default instance of SQL ServerSQL Server, the default port number is 1433. 对于命名实例,SSMA 将尝试从 Browser 服务获取端口号 SQL ServerSQL Server 。For named instances, SSMA will try to obtain the port number from the SQL ServerSQL Server Browser Service.

在 " 身份验证 " 框中,选择要用于连接的身份验证类型。In the Authentication box, select the authentication type to use for the connection. 若要使用当前的 Windows 帐户,请选择 " Windows 身份验证"。To use the current Windows account, select Windows Authentication. 若要使用 SQL ServerSQL Server 登录名,请选择 " SQL Server 身份验证",然后提供登录名和密码。To use a SQL ServerSQL Server login, select SQL Server Authentication, and then provide the login name and password.

对于安全连接,将添加两个控件,即 " 加密连接 " 和 " TrustServerCertificate " 复选框。For Secure connection, two controls are added, the Encrypt Connection and TrustServerCertificate check boxes. 只有在选中 " 加密连接 " 时," TrustServerCertificate " 复选框才可见。Only when Encrypt Connection is checked, the TrustServerCertificate check box is visible. 选中 " 加密连接 " (true) 并取消选中 " TrustServerCertificate " (false) ,它将验证 SQL ServerSQL Server SSL 证书。When Encrypt Connection is checked (true) and TrustServerCertificate is unchecked (false), it will validate the SQL ServerSQL Server SSL certificate. 验证服务器证书是 SSL 握手过程的一部分,这可确保服务器是要连接到的正确服务器。Validating the server certificate is a part of the SSL handshake and ensures that the server is the correct server to connect to. 为了确保这一点,证书必须安装在客户端和服务器端。To ensure this, a certificate must be installed on the client side as well as on the server side.

单击“连接”。Click Connect.

重要

虽然你可以连接到的更高版本 SQL ServerSQL Server ,但与创建迁移项目时选择的版本相比,数据库对象的转换由项目的目标版本而不是你连接到的的版本确定 SQL ServerSQL Server 。While you may connect to a higher version of SQL ServerSQL Server, compared to the version chosen when the migration project was created, conversion of the database objects is determined by the target version of the project and not the version of the SQL ServerSQL Server you are connected to.

同步 SQL Server 元数据Synchronizing SQL Server Metadata

SQL ServerSQL Server与数据库有关的元数据不会自动更新。Metadata about SQL ServerSQL Server databases is not automatically updated. SQL Server 元数据资源管理器 中的元数据是首次连接到时 SQL ServerSQL Server 或上次手动更新元数据时的元数据的快照。The metadata in SQL Server Metadata Explorer is a snapshot of the metadata when you first connected to SQL ServerSQL Server, or the last time that you manually updated metadata. 您可以为所有数据库或任何单个数据库或数据库对象手动更新元数据。You can manually update metadata for all databases, or for any single database or database object. 同步元数据:To synchronize metadata:

确保你已连接到 SQL ServerSQL Server 。Make sure that you are connected to SQL ServerSQL Server.

在 SQL Server 元数据资源管理器"中,选中要更新的数据库或数据库架构旁边的复选框。In SQL Server Metadata Explorer, select the check box next to the database or database schema that you want to update.

例如,若要更新所有数据库的元数据,请选中 " 数据库" 旁边的复选框。For example, to update the metadata for all databases, select the box next to Databases.

右键单击 " 数据库"、"数据库" 或 "数据库架构",然后选择 " 与数据库同步"。Right-click Databases, or the individual database or database schema, and then select Synchronize with Database.

下一步Next Step

迁移的下一步取决于你的项目需求:The next step in the migration depends on your project needs:

若要自定义 MySQL 架构与 SQL Server 数据库和架构之间的映射,请参阅 将 Mysql 数据库映射到 SQL Server 架构 (MySQLToSQL)。To customize the mapping between MySQL schemas and SQL Server databases and schemas, see Mapping MySQL Databases to SQL Server Schemas (MySQLToSQL).

To customize configuration options for the projects, see Setting Project Options (MySQLToSQL).

如果不需要执行这些任务中的任何一种,可以将 MySQL 数据库对象定义转换为 SQL ServerSQL Server 对象定义。If you do not have to perform any of these tasks, you can convert the MySQL database object definitions into SQL ServerSQL Server object definitions.

另请参阅See Also

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值