You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/migrate/tutorial-discover-mysql-database-instances.md
+51-2Lines changed: 51 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ monikerRange:
11
11
# Customer intent: As a database administrator, I want to discover MySQL database instances in my datacenter using an agentless solution, so that I can assess and manage my databases efficiently before migrating to the cloud.
12
12
---
13
13
14
-
# Tutorial: Discover MySQL database instances running in your datacenter (preview)
14
+
# Discover MySQL database instances running in your datacenter (preview)
15
15
16
16
17
17
This article describes how to discover MySQL database instances running on servers in your datacenter, using **Azure Migrate appliance**. The discovery process is agentless; no agents are installed on the target servers.
@@ -53,7 +53,7 @@ The following table lists the regions that support MySQL Discovery and Assessmen
53
53
54
54
1. Open the appliance configuration manager, complete the prerequisite checks and registration of the appliance.
55
55
2. Navigate to the Manage credentials and discovery sources panel.
56
-
1. In Step 3: Select **MySQL authentication** credential type, provide a friendly name, input the MySQL username, and password and select **Save**.
56
+
3. In Step 3: Select **MySQL authentication** credential type, provide a friendly name, input the MySQL username, and password and select **Save**.
57
57
58
58
> [!NOTE]
59
59
> - Ensure that the user corresponding to the added MySQL credentials have the following privileges:
@@ -69,6 +69,55 @@ The following table lists the regions that support MySQL Discovery and Assessmen
69
69
> GRANT SELECT ON information_schema.* TO 'username'@'ip';
70
70
> GRANT SELECT ON performance_schema.* TO 'username'@'ip';
71
71
72
+
To enable Discovery and Assessment in Azure Migrate, you can create a custom MySQL user account with the minimum required permissions. Use the following script to create the account and grant access from the appliance machine.
73
+
- CREATE USER privilege → to create the new user.
74
+
- GRANT OPTION privilege → to grant privileges to the new user.
75
+
- SELECT on mysql.user → required for the existence check.
76
+
- PROCESS privilege → if you want to verify process-related grants after creation.
77
+
78
+
```
79
+
80
+
-- MySQL Script to Create a Least-Privilege User for Azure Migrate
81
+
-- Replace @username, @password, and @ip with actual values before execution.
82
+
83
+
SET @username = 'your_username';
84
+
SET @password = 'your_password';
85
+
SET @ip = 'your_appliance_ip';
86
+
87
+
-- Check if the user already exists
88
+
SELECT CASE
89
+
WHEN EXISTS (SELECT 1 FROM mysql.user WHERE user = @username AND host = @ip)
CONCAT('User ', @username, '@', @ip, ' does not exist, proceeding with creation')
93
+
END AS user_check;
94
+
95
+
-- Create the user if not exists
96
+
CREATE USER IF NOT EXISTS @username@'@ip' IDENTIFIED BY @password;
97
+
98
+
-- Grant minimal required privileges
99
+
GRANT USAGE ON *.* TO @username@'@ip';
100
+
GRANT PROCESS ON *.* TO @username@'@ip';
101
+
102
+
-- Grant SELECT on specific columns in mysql.user
103
+
GRANT SELECT (User, Host, Super_priv, File_priv, Create_tablespace_priv, Shutdown_priv)
104
+
ON mysql.user TO @username@'@ip';
105
+
106
+
-- Grant SELECT on information_schema and performance_schema
107
+
GRANT SELECT ON information_schema.* TO @username@'@ip';
108
+
GRANT SELECT ON performance_schema.* TO @username@'@ip';
109
+
110
+
-- Apply changes
111
+
FLUSH PRIVILEGES;
112
+
113
+
-- Log success
114
+
SELECT CONCAT('Azure Migrate user ', @username, '@', @ip, ' created successfully with least privileges.') AS result;
115
+
```
116
+
Execute the script using the following command through your MySQL client.
117
+
```
118
+
mysql -u root -p -e "SET @username='myuser'; SET @password='mypassword'; SET @ip='appliance_ip'; SOURCE CreateUser.sql;"
119
+
```
120
+
72
121
You can review the discovered MySQL databases after around 24 hours of discovery initiation, through the **Discovered servers** view. To expedite the discovery of your MySQL instances follow the steps:
73
122
74
123
- After adding the MySQL credentials on the appliance configuration manager restart the discovery services on appliance.
0 commit comments