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/mysql/concepts-query-store.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,7 +104,7 @@ Use the [Azure portal](howto-server-parameters.md) or [Azure CLI](howto-confi
104
104
105
105
## Views and functions
106
106
107
-
View and manage Query Store using the following views and functions. Anyone in the [select privilege public role](howto-create-users.md#to-create-more-admin-users-in-azure-database-for-mysql) can use these views to see the data in Query Store. These views are only available in the **mysql** database.
107
+
View and manage Query Store using the following views and functions. Anyone in the [select privilege public role](howto-create-users.md) can use these views to see the data in Query Store. These views are only available in the **mysql** database.
108
108
109
109
Queries are normalized by looking at their structure after removing literals and constants. If two queries are identical except for literal values, they will have the same hash.
title: How to create databases for Azure Database for MySQL Flexible Server
3
+
description: This article describes how to create and manage databases on Azure Database for MySQL Flexible server.
4
+
author: mksuni
5
+
ms.author: sumuth
6
+
ms.service: mysql
7
+
ms.topic: how-to
8
+
ms.date: 02/17/2022
9
+
---
10
+
11
+
# Create and manage databases for Azure Database for MySQL Flexible Server
12
+
13
+
This article contains information about creating, listing, and deleting MySQL databases on Azure Database for Flexible Server.
14
+
15
+
## Prerequisites
16
+
Before completing the tasks, you must have
17
+
- Created an Azure Database for MySQL Flexible server using [Azure portal](./quickstart-create-server-portal.md) <br/> or [Azure CLI](./quickstart-create-server-cli.md).
18
+
- Sign in to [Azure portal](https://portal.azure.com).
19
+
20
+
21
+
## List your databases
22
+
To list all your databases on MySQL flexible server:
23
+
- Open the **Overview** page of your MySQL flexible server.
24
+
- Select **Databases** from the settings on left navigation menu.
25
+
26
+
> :::image type="content" source="media/how-to-create-manage-databases/databases-view-mysql-flexible-server.png" alt-text="Screenshot showing how to list all the databases on Azure Database for MySQL flexible server":::
27
+
28
+
## Create a database
29
+
To create a database on MySQL flexible server:
30
+
31
+
- Select **Databases** from the settings on left navigation menu.
32
+
- Click on **Add** to create a database. Provide the database name, charset and collation settings for this database.
33
+
- Click on **Save** to complete the task.
34
+
35
+
> :::image type="content" source="media/how-to-create-manage-databases/create-database-azure-mysql-flexible-server.png" alt-text="Screenshot showing how to create a database on Azure Database for MySQL flexible server":::
36
+
37
+
## Delete a database
38
+
To delete a database on MySQL flexible server:
39
+
40
+
- Select **Databases** from the settings on left navigation menu.
41
+
- Click on **testdatabase1** to select the database. You can select multiple databases to delete at the same time.
42
+
- Click on **Delete** to complete the task.
43
+
44
+
> :::image type="content" source="media/how-to-create-manage-databases/delete-database-on-mysql-flexible-server.png" alt-text="Screenshot showing how to delete a database on Azure Database for MySQL flexible server":::
45
+
46
+
## Next steps
47
+
48
+
Learn how to [manage users](../howto-create-users.md)
This article describes how to create users in Azure Database for MySQL.
15
+
This article describes how to create users for Azure Database for MySQL.
16
16
17
17
> [!NOTE]
18
18
> This article contains references to the term *slave*, a term that Microsoft no longer uses. When the term is removed from the software, we'll remove it from this article.
@@ -30,87 +30,67 @@ After you create an Azure Database for MySQL server, you can use the first serve
30
30
>
31
31
> Password plugins like `validate_password` and `caching_sha2_password` aren't supported by the service.
32
32
33
-
## To create a database with a non-admin user in Azure Database for MySQL
33
+
## Create a database
34
34
35
35
1. Get the connection information and admin user name.
36
36
To connect to your database server, you need the full server name and admin sign-in credentials. You can easily find the server name and sign-in information on the server **Overview** page or on the **Properties** page in the Azure portal.
37
37
38
38
2. Use the admin account and password to connect to your database server. Use your preferred client tool, such as MySQL Workbench, mysql.exe, or HeidiSQL.
39
39
40
-
If you're not sure how to connect, see [connect and query data for Single Server](./connect-workbench.md) or [connect and query data for Flexible Server](./flexible-server/connect-workbench.md).
40
+
> [!NOTE]
41
+
> If you're not sure how to connect, see [connect and query data for Single Server](./connect-workbench.md) or [connect and query data for Flexible Server](./flexible-server/connect-workbench.md).
41
42
42
43
3. Edit and run the following SQL code. Replace the placeholder value `db_user` with your intended new user name. Replace the placeholder value `testdb` with your database name.
43
44
44
45
This SQL code creates a new database named testdb. It then creates a new user in the MySQL service and grants all privileges for the new database schema (testdb.\*) to that user.
45
46
46
47
```sql
47
48
CREATEDATABASEtestdb;
49
+
```
48
50
51
+
## Create a non-dmin user
52
+
Now that the database is created , you can create with a non-admin user with the ``` CREATE USER``` MySQL statement.
53
+
```sql
49
54
CREATEUSER 'db_user'@'%' IDENTIFIED BY 'StrongPassword!';
50
55
51
56
GRANT ALL PRIVILEGES ON testdb . * TO 'db_user'@'%';
52
57
53
58
FLUSH PRIVILEGES;
54
59
```
55
60
56
-
4. Verify the grants in the database:
61
+
## Verify the user permissions
62
+
Run the ```SHOW GRANTS``` MySQL statement to view the privileges allowed for user **db_user** on **testdb** database.
57
63
58
64
```sql
59
65
USE testdb;
60
66
61
67
SHOW GRANTS FOR 'db_user'@'%';
62
68
```
63
69
64
-
5. Sign in to the server, specifying the designated database and using the new user name and password. This example shows the mysql command line. When you use this command, you'll be prompted for the user's password. Use your own server name, database name, and user name.
65
-
66
-
### [Single Server](#tab/single-server)
70
+
## Connect to the database with new user
71
+
Sign in to the server, specifying the designated database and using the new user name and password. This example shows the mysql command line. When you use this command, you'll be prompted for the user's password. Use your own server name, database name, and user name. See how to connect for Single server and Flexible server below.
67
72
68
-
```azurecli-interactive
69
-
mysql --host mydemoserver.mysql.database.azure.com --database testdb --user db_user@mydemoserver -p
70
-
```
71
-
72
-
### [Flexible Server](#tab/flexible-server)
73
+
| Server type | Usage |
74
+
| ----------- | ----------- |
75
+
| Single Server |```mysql --host mydemoserver.mysql.database.azure.com --database testdb --user db_user@mydemoserver -p```|
76
+
| Flexible Server |``` mysql --host mydemoserver.mysql.database.azure.com --database testdb --user db_user -p```|
73
77
74
-
```azurecli-interactive
75
-
mysql --host mydemoserver.mysql.database.azure.com --database testdb --user db_user -p
76
-
```
77
78
78
-
## To create more admin users in Azure Database for MySQL
79
-
80
-
1. Get the connection information and admin user name.
81
-
To connect to your database server, you need the full server name and admin sign-in credentials. You can easily find the server name and sign-in information on the server **Overview** page or on the **Properties** page in the Azure portal.
82
-
83
-
2. Use the admin account and password to connect to your database server. Use your preferred client tool, such as MySQL Workbench, mysql.exe, or HeidiSQL.
84
-
85
-
If you're not sure how to connect, see [Use MySQL Workbench to connect and query data](./connect-workbench.md).
86
-
87
-
3. Edit and run the following SQL code. Replace the placeholder value `new_master_user` with your new user name. This syntax grants the listed privileges on all the database schemas (*.*) to the user (`new_master_user` in this example).
79
+
## Limit privileges for user
80
+
To restrict the type of operations a user can run on the database, you need to explicitly add the operations in the **GRANT** statement. See an example below:
88
81
89
82
```sql
90
83
CREATEUSER 'new_master_user'@'%' IDENTIFIED BY 'StrongPassword!';
91
84
92
85
GRANTSELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON*.* TO 'new_master_user'@'%' WITH GRANT OPTION;
93
86
94
-
FLUSH PRIVILEGES;
95
-
```
96
-
97
-
4. Verify the grants:
98
-
99
-
```sql
100
-
USE sys;
101
-
102
-
SHOW GRANTS FOR 'new_master_user'@'%';
87
+
FLUSH PRIVILEGES;
103
88
```
104
89
105
-
## azure_superuser
90
+
## About azure_superuser
106
91
107
92
All Azure Database for MySQL servers are created with a user called "azure_superuser". This is a system account created by Microsoft to manage the server to conduct monitoring, backups, and other regular maintenance. On-call engineers may also use this account to access the server during an incident with certificate authentication and must request access using just-in-time (JIT) processes.
108
93
109
94
## Next steps
110
95
111
-
Open the firewall for the IP addresses of the new users' machines to enable them to connect:
112
-
113
-
*[Create and manage firewall rules on Single Server](howto-manage-firewall-using-portal.md)
114
-
*[Create and manage firewall rules on Flexible Server](flexible-server/how-to-connect-tls-ssl.md)
115
-
116
96
For more information about user account management, see the MySQL product documentation for [User account management](https://dev.mysql.com/doc/refman/5.7/en/access-control.html), [GRANT syntax](https://dev.mysql.com/doc/refman/5.7/en/grant.html), and [Privileges](https://dev.mysql.com/doc/refman/5.7/en/privileges-provided.html).
0 commit comments