How to Set up a MySQL Server on Ubuntu 20.04
MySQL, a Relational Database Management System (RDBMS), is one of the four open-source building blocks (LAMP) used to set up most web applications. It makes use of the Structured Query Language to manipulate, process, and organise data into useful in...
funmifagoyinbo.hashnode.dev4 min read
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_socketby 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 tomysql_native_password. Afterward, I was able to run themysql_secure_installationscript 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:
sudo apt update && sudo apt upgrade -y.sudo apt install mysql-server -y.auth_sockettomysql_native_passwordand then ranmysql_secure_installation.You can check out the full Vultr guide here: How to Install MySQL on Ubuntu 20.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.