MySQL MariaDB

How to Create MySQL Database in Azure?

Transferring the data over to the Cloud hosted Databases is one of the most important practices. Doing this ensures complete safety, availability, and maintenance. However, this process of creating and shifting data to a Cloud hosted Platform like Azure can be really daunting. This post will provide a Step-by-step guide to creating a MySQL Database in Azure.

How to Create MySQL Database in Azure?

Start by going to the Azure Portal by clicking here and login into the Azure portal. After the successful login, simply search Azure database for MySQL and click on it:

After that, click on the create button under the Azure Database for MySQL servers:

And then again, click on the create button under the Flexible server section:

Now let’s provide the details by first providing the Resource group under the Project details:

Then in the server details, provide the server name, and MySQL version, and select the workload type. After that, in order to change the Compute + Storage configurations, simply click on the Configure server button:

Do the configuration in the Compute + Storage according to your requirements and click on the Save button:

After that, select the Authentication Method and provide the Admin username and Password and then click on “Next : Networking” button:

Then in the Networking section, select the public access in front of the connectivity method, add the firewall rules, and then click on the “Next: Security” button:

Leave the Security section as default and click on the “Next: Tags” button:

Note: The security section can be changed according to your requirements.

The tag section is optional, this means that the Tags can be left blank. Therefore, simply click on the “Next” button:

Now just review it, and after the confirmation, simply click on the “create” button:

After that, wait for the deployment to fully complete and after that, in order to connect to the database simply click on the “Go to resource” button:

From the overview page, copy the “Server Name”:

In order to connect simply open the command prompt by pressing the windows button and typing “cmd”:

And type the following command to connect with MySQL and give the password after hitting the enter:

mysql -h mysql-linuxhint-db.mysql.database.azure.com -u md -p

In the above command:

  • The “-h” is for that host
  • The “-u” is for the username
  • The -p” is for the password

Note: Change everything here accordingly. Additionally, the Port number can also be mentioned by using the -P flag.

The output clearly shows that you are now connected with the MySQL database.

Conclusion

To Create MySQL Database in azure, simply login to the azure portal and go to the Azure Database for MySQL, then select the server and give the proper details to it. Make sure to select MySQL Authentication. At the end, review the details and click on the create button. After the deployment, simply connect it using the “mysql -h [server-name] -u [username] -p” command.

About the author

Abdul Mannan

I am curious about technology and writing and exploring it is my passion. I am interested in learning new skills and improving my knowledge and I hold a bachelor's degree in computer science.