VOOZH about

URL: https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-22-04?comment=191211

⇱ Step-by-Step MySQL Installation on Ubuntu | DigitalOcean


Step-by-Step MySQL Installation on Ubuntu

Updated on October 2, 2025
Not using Ubuntu 22.04?
Choose a different version or distribution.
Ubuntu 22.04
👁 Step-by-Step MySQL Installation on Ubuntu

1-click deploy a MySQL database using DigitalOcean Managed Databases. Let DigitalOcean focus on scaling, maintenance, and upgrades for your database.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author(s)

👁 Mark Drake
Mark Drake
Author
Manager, Developer Education
See author profile

Former Technical Writer at DigitalOcean. Focused on SysAdmin topics including Debian 11, Ubuntu 22.04, Ubuntu 20.04, Databases, SQL and PostgreSQL.

Associate Technical Writer @ DigitalOcean

👁 Vinayak Baranwal
Vinayak Baranwal
Editor
Technical Writer II
See author profile

Building future-ready infrastructure with Linux, Cloud, and DevOps. Full Stack Developer & System Administrator. Technical Writer @ DigitalOcean | GitHub Contributor | Passionate about Docker, PostgreSQL, and Open Source | Exploring NLP & AI-TensorFlow | Nailed over 50+ deployments across production environments.

Still looking for an answer?

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

I keep getting the following error on running sudo mysql_secure_installation

 ... Failed! Error: SET PASSWORD has no significance for user 'root'@'localhost' as the authentication method used doesn't store authentication data in the MySQL server. Please consider using ALTER USER instead if you want to change authentication parameters.

What to do?

very helpful guys. saved my buns with this one!! thank you.

It should be mentioned that you have to have at least 1GB RAM on your droplet.

It should be mentioned that you have to have at least 1GB RAM on your droplet.

I followed instructions carefully but I still get a recursive loop when I tried to use mysql_secure_installation. What can be wrong? John Higgin in comments mentioned that the computer must have at least 1GB RAM. If I write “free -h”, I get: “Memory 906 Mi”. Can this be a problem?

Your article does not work for MySQL 8. You have an error in article. instead of your show example GRANT PRIVILEGE ... line. it should be like this: https://stackoverflow.com/a/50197630/2377343

also, please add/mention an example of adding database like: CREATE DATABASE testdb1; and assigning privileges only to that database for particular mysql user.

I am unable to open up airflow webserver after following this guide and am getting 'myuserame@LAPTOP-28BMMQV7:/root$ cd airflow/' bash: cd: airflow/: Permission denied. and myusername@LAPTOP-28BMMQV7:/root$ airflow webserver -p 8080 Error: [Errno 13] Permission denied: '/root'.

can someone help me? https://askubuntu.com/questions/1441722/permissions-problem-in-ubuntu-when-accessing-airflow-webserver-as-root-and-non-r

In step 2 the “ALTER RULE…WITH auth_socket” command must be placed after the “sudo mysql_secure_installation”. Otherwise you get the same ERROR: SET PASSWORD …!

In step 2 the “ALTER RULE…WITH auth_socket” command must be placed after the “sudo mysql_secure_installation”. Otherwise you get the same ERROR: SET PASSWORD …!

👁 Creative Commons
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and AI-native businesses

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

© 2026 DigitalOcean, LLC.Sitemap.
Dark mode is coming soon.