---
title: "Comment by Php_Guider on \"How to Set up a MySQL Server on Ubuntu 20.04\" | Hashnode"
description: "I had a tough time setting up MySQL on my Ubuntu 20.04 server and kept running into roadblocks. I followed a guide on installing MySQL on DigitalOcean, but ther"
url: "https://hashnode.com/posts/how-to-set-up-a-mysql-server-on-ubuntu-2004/637c1dd82b0382694ed642e7/comment/674a3b48e617401394bb38f9"
---

[Discussion](https://hashnode.com/posts/how-to-set-up-a-mysql-server-on-ubuntu-2004/637c1dd82b0382694ed642e7)

Comment [How to Set up a MySQL Server on Ubuntu 20.04](https://hashnode.com/posts/how-to-set-up-a-mysql-server-on-ubuntu-2004/637c1dd82b0382694ed642e7)

[Php\_Guider](https://hashnode.com/@phpguider)

[Nov 29, 2024](https://hashnode.com/posts/how-to-set-up-a-mysql-server-on-ubuntu-2004/637c1dd82b0382694ed642e7/comment/674a3b48e617401394bb38f9)

I had a tough time setting up MySQL on my Ubuntu 20.04 server and kept running into roadblocks. I followed a guide on installing MySQL on DigitalOcean, but there were some tricky steps, especially with securing the installation and configuring the root user authentication method.

The main challenge I faced was the authentication method, which uses `auth_socket` by default, and I couldn’t log in properly without changing it. I found the solution to this problem by setting a root password and switching the authentication to `mysql_native_password`. Afterward, I was able to run the `mysql_secure_installation` script to lock down the server's security settings.

Thankfully, I found a helpful guide on **Vultr** that not only clarified the process but also provided essential steps on how to install and secure MySQL on Ubuntu 20.04. The guide includes detailed instructions on setting up the server, including how to handle the root user authentication issues I encountered. It also walks you through creating a database and user with sudo privileges, which helped me finalize the setup.

Here's a summary of how I followed the **Vultr** guide:

1.  I first updated my system with `sudo apt update && sudo apt upgrade -y`.
2.  Then, I installed MySQL with `sudo apt install mysql-server -y`.
3.  Securing MySQL was tricky, but I followed the steps in the guide to change the default `auth_socket` to `mysql_native_password` and then ran `mysql_secure_installation`.
4.  Finally, I created a new database and user with the necessary privileges.

You can check out the full Vultr guide here: [How to Install MySQL on Ubuntu 20.04](https://docs.vultr.com/how-to-install-mysql-on-ubuntu-24-04).

Following this guide helped me set up MySQL securely and avoid the common pitfalls I initially encountered. If you're facing similar issues, I highly recommend this guide as it offers a clear and concise solution.
