Download MySQL for Linux
Downloading MySQL for Linux is best done through Oracle's official repositories: the APT repository on Ubuntu and Debian, the YUM/DNF repository on RHEL, Fedora, and Oracle Linux, or the generic tarball anywhere else. Each pulls the genuine MySQL Community Server from dev.mysql.com — no Oracle account — and the exact commands are below.
Independent project — not Oracle. Commands last verified .
Links land on Oracle's own servers. SQL Mirror hosts no packages and changes nothing in them.
Ubuntu & Debian: the APT repository
On Ubuntu or Debian, add Oracle's APT repository once, then install and update MySQL like any other package. This gives you the real, current MySQL Community Server rather than a distro back-port:
# 1. fetch the APT config package (check dev.mysql.com for the current filename) wget https://dev.mysql.com/get/mysql-apt-config_0.8.34-1_all.deb # 2. add Oracle's official APT repo (choose 8.4 LTS in the prompt) sudo dpkg -i mysql-apt-config_*_all.deb # 3. refresh and install sudo apt update sudo apt install mysql-server # 4. secure it, then check the service sudo mysql_secure_installation sudo systemctl status mysql
- Add the MySQL APT repositoryDownload the mysql-apt-config .deb from dev.mysql.com and install it with dpkg. It registers Oracle's official APT repository and lets you choose the 8.4 LTS or Innovation series.
- Update the package listRun sudo apt update so apt picks up the newly added MySQL repository.
- Install MySQL ServerRun sudo apt install mysql-server. apt pulls the official MySQL Community Server and its dependencies.
- Secure and start itRun sudo mysql_secure_installation to set the root password, then confirm the service with sudo systemctl status mysql.
The mysql-apt-config version in the wget URL above (0.8.34-1) increments with each release. If it returns 404, copy the current filename from the official MySQL APT repository page.
RHEL, Fedora & Oracle Linux: the YUM repository
On Red Hat-family distributions, install Oracle's community release RPM, then use dnf (or yum):
# add the MySQL YUM repository sudo rpm -Uvh https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm # install the server sudo dnf install mysql-community-server # start it, then read the temporary root password sudo systemctl start mysqld sudo grep 'temporary password' /var/log/mysqld.log
Oracle bumps the release-RPM filename with each revision (el9-1 → el9-2, and el8 for older systems). If the URL above 404s, copy the current one from the official MySQL YUM repository page.
Any distro: the generic tarball
If your distribution isn't covered — or you want a self-contained install with no system package manager — download the Linux - Generic tarball (.tar.xz, glibc build). It extracts anywhere and is the route for containers and locked-down servers. It's the most manual option: you create the mysql user, initialise the data directory, and register the service yourself.
Which method should you use?
| Method | Best for | Updates |
|---|---|---|
| APT repository | Ubuntu, Debian | Automatic via apt upgrade |
| YUM/DNF repository | RHEL, Fedora, Oracle Linux | Automatic via dnf upgrade |
| Generic tarball | Containers, other distros | Manual re-download |
After installing: verify it works
Whichever method you used, confirm MySQL is installed and running, then open a session as root:
# check the installed version mysql --version # confirm the service is active (systemd distros) sudo systemctl status mysql # or mysqld on RHEL-family # connect as root mysql -u root -p
From the mysql> prompt you can create your first database with CREATE DATABASE mydb;. The official MySQL getting-started guide covers users, privileges, and importing data.
Secure MySQL and create a user
On a fresh install, run the guided hardening script before anything else. It walks you through setting a root password, removing anonymous accounts, disabling remote root login, and dropping the test database:
# answer Y to each prompt on a normal setup
sudo mysql_secure_installation
Then create a dedicated, non-root user for your application rather than connecting as root. Root has full control of every database on the server; an application user scoped to one database limits the blast radius if credentials leak:
sudo mysql -u root -p
# inside the mysql> prompt:
CREATE DATABASE appdb;
CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'a-strong-password';
GRANT ALL PRIVILEGES ON appdb.* TO 'appuser'@'localhost';
FLUSH PRIVILEGES;
Log back in as that user with mysql -u appuser -p appdb to confirm the grant works.
Two common first-run errors
"Access denied for user 'root'@'localhost'" — on Ubuntu/Debian, a fresh mysql-server often configures root to use the auth_socket plugin, so root authenticates by system user, not a password. Connect with sudo mysql (no -p) instead; from there you can set a password or, better, create the application user above.
"Can't connect through socket '/var/run/mysqld/mysqld.sock'" — this means the server isn't running. Start it with sudo systemctl start mysql (or mysqld on RHEL-family), then sudo systemctl enable it so it starts on boot.
Verify the download (optional but recommended)
For the generic tarball, confirm the file matches the SHA-256 checksum Oracle lists next to it on the download page before you extract it — this proves you got the genuine, untampered file:
sha256sum mysql-*.tar.xz
# compare the output to the SHA256 shown on dev.mysql.com
The APT and YUM repositories verify package signatures automatically via the GPG key, so no manual checksum step is needed there.
Linux download questions
How do I install MySQL on Ubuntu?
On Ubuntu the cleanest path is Oracle's official APT repository. Download the mysql-apt-config package, install it with sudo dpkg -i, run sudo apt update, then sudo apt install mysql-server. This gives you the official MySQL Community Server with automatic security updates through apt.
Should I use the APT repository or the Ubuntu default mysql-server?
Ubuntu's built-in mysql-server package installs genuine MySQL, but it often trails Oracle's release by several point versions. Oracle's APT repository gives you the current, upstream MySQL Community Server with timely security patches, which is why SQL Mirror points you there.
How do I install MySQL on RHEL, Fedora, or Oracle Linux?
Use Oracle's YUM repository. Install the mysql community release RPM with sudo rpm -Uvh, then run sudo dnf install mysql-community-server. Start it with sudo systemctl start mysqld and find the temporary root password in the mysqld log at /var/log/mysqld.log.
Do I need an Oracle account to download MySQL for Linux?
No. The APT and YUM repository packages and the generic tarball are all public on dev.mysql.com. SQL Mirror links straight to them with no Oracle account and no signup.
Is MySQL for Linux free?
Yes. MySQL Community Server is open source under GPLv2 and free on every Linux distribution. SQL Mirror is free too and hosts none of the files.
On a different machine? Download MySQL for Windows or download MySQL for macOS.