{"id":1341,"date":"2024-04-16T17:09:13","date_gmt":"2024-04-16T14:09:13","guid":{"rendered":"https:\/\/www.fibacloud.com\/community\/tutorials\/?p=1341"},"modified":"2026-10-04T22:57:46","modified_gmt":"2026-10-04T19:57:46","slug":"mysql-installation-and-management-on-ubuntu","status":"publish","type":"post","link":"https:\/\/www.fibacloud.com\/community\/tutorials\/en\/mysql-installation-and-management-on-ubuntu\/","title":{"rendered":"Install MySQL 8.4 LTS on Ubuntu 24.04"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"1341\" class=\"elementor elementor-1341\" data-elementor-post-type=\"post\">\n\t\t\t\t<div class=\"elementor-element elementor-element-26f7868 e-con-full e-flex e-con e-parent\" data-id=\"26f7868\" data-element_type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-1c8fc90 elementor-widget elementor-widget-text-editor\" data-id=\"1c8fc90\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.21.0 - 08-05-2024 *\/\n.elementor-widget-text-editor.elementor-drop-cap-view-stacked .elementor-drop-cap{background-color:#69727d;color:#fff}.elementor-widget-text-editor.elementor-drop-cap-view-framed .elementor-drop-cap{color:#69727d;border:3px solid;background-color:transparent}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap{margin-top:8px}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap-letter{width:1em;height:1em}.elementor-widget-text-editor .elementor-drop-cap{float:left;text-align:center;line-height:1;font-size:50px}.elementor-widget-text-editor .elementor-drop-cap-letter{display:inline-block}<\/style>\t\t\t\t<p>This guide prepares a <strong>new MySQL 8.4 LTS server on Ubuntu 24.04 LTS<\/strong>. You will verify the package source, local access, application privileges and restoration into a separate database. It is not an upgrade or conversion procedure for an existing MySQL or MariaDB data directory.<\/p>\n<figure class=\"fc-editorial-figure\" data-fc-visual=\"20260920\" aria-labelledby=\"fc-editorial-caption-1341\"><a href=\"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-mysql-en-inline-20260920.webp\" target=\"_blank\" rel=\"noopener\" aria-label=\"Open full-size illustration\"><picture><source media=\"(max-width: 600px)\" srcset=\"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-mysql-en-mobile-20260920.webp\" width=\"720\" height=\"1140\"><img loading=\"lazy\" src=\"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-mysql-en-inline-20260920.webp\" srcset=\"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-mysql-en-inline-20260920.webp 1440w, https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-mysql-en-inline-20260920-300x242.webp 300w, https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-mysql-en-inline-20260920-1024x825.webp 1024w, https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-mysql-en-inline-20260920-768x619.webp 768w\" sizes=\"auto, (max-width: 900px) 100vw, 820px\" width=\"1440\" height=\"1160\" alt=\"MySQL: connections and permissions\" class=\"wp-image-2512\"  decoding=\"async\"><\/picture><\/a><figcaption id=\"fc-editorial-caption-1341\"><strong>MySQL: connections and permissions<\/strong> The application connects with a dedicated database account. Authentication, minimum required permissions and backups work together.<details><summary>Step-by-step explanation<\/summary><ol><li>Connect: Use a dedicated application account.<\/li><li>Authenticate: Restrict user and source host.<\/li><li>Authorize: Grant only the required database access.<\/li><li>Protect: Back up and test restoration.<\/li><\/ol><\/details><\/figcaption><\/figure>\n<h2>Before you begin<\/h2>\n<p>You need a sudo user, server-console access and adequate free disk space. Back up existing data and <code>\/etc\/mysql<\/code> configuration. If these checks reveal an existing database installation, stop and use its documented upgrade or migration procedure instead of replacing packages.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c26a27b elementor-widget elementor-widget-text-editor\" data-id=\"c26a27b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-bash\">cat \/etc\/os-release\ndpkg-query -W 'mysql*' 'mariadb*' 2&gt;\/dev\/null\nss -lnt | awk '$4 ~ \/:3306$\/ {print}'<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6908e2e elementor-widget elementor-widget-text-editor\" data-id=\"6908e2e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The Ubuntu package name <code>mysql-server<\/code> does not, by itself, identify <strong>8.4<\/strong>. Verify both the version and the repository that supplies it.<\/p>\n<h2>Select the official APT source<\/h2>\n<p>Download the current <code>mysql-apt-config<\/code> package using the link in the <a href=\"https:\/\/dev.mysql.com\/doc\/mysql-apt-repo-quick-guide\/en\/\" rel=\"nofollow noopener\" target=\"_blank\">MySQL APT quick guide<\/a>. Complete the signature\/integrity checks described there; do not run a third-party installation script. Pass the <strong>actual name of the single downloaded file<\/strong> to <code>sudo dpkg -i<\/code>, without an unresolved version placeholder. Confirm your Ubuntu release and select the <strong>mysql-8.4-lts<\/strong> series in the configuration screen.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e9a935b elementor-widget elementor-widget-text-editor\" data-id=\"e9a935b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-bash\">sudo apt-get update\napt-cache policy mysql-community-server mysql-server<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-bda359f elementor-widget elementor-widget-text-editor\" data-id=\"bda359f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The candidate must be 8.4.x from the expected Oracle MySQL repository. Stop on an APT signature error; do not disable signature verification. Then install the new server:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8cc0ae9 elementor-widget elementor-widget-text-editor\" data-id=\"8cc0ae9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-bash\">sudo apt-get install mysql-server\nsudo systemctl enable --now mysql\nsudo systemctl status mysql --no-pager\nmysql --version<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a2f6e13 elementor-widget elementor-widget-text-editor\" data-id=\"a2f6e13\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Use the administrator authentication selected during installation. For a password-authenticated root account, <code>mysql -u root -p<\/code> prompts interactively. Use <code>sudo mysql<\/code> only when socket authentication is actually configured. A rejected login method is not, on its own, a reason to reset the password; check the installation choice first.<\/p>\n<h2>Verify the server and its access boundary<\/h2>\n<p>In an administrator session:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-bb8fa5b elementor-widget elementor-widget-text-editor\" data-id=\"bb8fa5b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-sql\">SELECT VERSION(), CURRENT_USER();\nSHOW VARIABLES WHERE Variable_name IN\n  ('bind_address','port','require_secure_transport','character_set_server');\nSELECT User, Host, plugin FROM mysql.user;<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f51ff8e elementor-widget elementor-widget-text-editor\" data-id=\"f51ff8e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The application in this guide runs on the same server, so port 3306 does not need public exposure. Prefer a local socket. A remote application needs a separate design for private networking, allowed source addresses and verified TLS certificates. MySQL accounts identify both user and origin: <code>'fc_app'@'localhost'<\/code> is not a remote account.<\/p>\n<p>Before removing an unused account, verify its owner and dependencies, then use <code>DROP USER<\/code>. <strong>Do not modify the <code>mysql.user<\/code> table with UPDATE or DELETE.<\/strong> Use <code>CREATE USER<\/code>, <code>ALTER USER<\/code>, <code>GRANT<\/code> and <code>REVOKE<\/code>; those account-management statements do not require a subsequent <code>FLUSH PRIVILEGES<\/code>.<\/p>\n<h2>Grant only the application privileges you need<\/h2>\n<p><code>appdb<\/code> below is a new training database. Stop if that name is already in use and choose a separate test name. Store the generated password in a password manager; keep it out of screenshots and job logs.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9034a8a elementor-widget elementor-widget-text-editor\" data-id=\"9034a8a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-sql\">CREATE DATABASE appdb\n  CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;\nCREATE TABLE appdb.tasks (\n  id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,\n  title VARCHAR(200) NOT NULL,\n  done BOOLEAN NOT NULL DEFAULT FALSE\n) ENGINE=InnoDB;\nCREATE USER 'fc_app'@'localhost' IDENTIFIED BY RANDOM PASSWORD;\nGRANT SELECT, INSERT, UPDATE, DELETE ON appdb.* TO 'fc_app'@'localhost';\nSHOW GRANTS FOR 'fc_app'@'localhost';<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-78f7e16 elementor-widget elementor-widget-text-editor\" data-id=\"78f7e16\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Your application should not use root. If deployments need schema changes, use a separate migration account with only the required DDL privileges on this database. Do not grant global <code>*.*<\/code> privileges to the runtime account.<\/p>\n<h2>Exercise successful and denied operations<\/h2>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d69306f elementor-widget elementor-widget-text-editor\" data-id=\"d69306f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-bash\">mysql --protocol=SOCKET --default-character-set=utf8mb4 -u fc_app -p appdb<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a864286 elementor-widget elementor-widget-text-editor\" data-id=\"a864286\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-sql\">INSERT INTO tasks(title) VALUES ('\u0130stanbul yede\u011fi \ud83d\ude80');\nSELECT id, title, done FROM tasks;\nCREATE TABLE permission_probe(id INT);<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-435416d elementor-widget elementor-widget-text-editor\" data-id=\"435416d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The first two statements should succeed. The last must fail with a <strong>privilege error<\/strong> for the restricted application account; do not \u201cfix\u201d this expected denial by granting broad permissions. <code>utf8mb4<\/code> also stores four-byte Unicode characters. Avoid carrying the old <code>utf8<\/code>\/utf8mb3 choice into new schemas.<\/p>\n<h2>Verify backup and recovery<\/h2>\n<p>A running service alone does not complete installation. Use the InnoDB dump procedure in the <a href=\"https:\/\/www.fibacloud.com\/community\/tutorials\/en\/how-to-create-and-manage-a-mysql-database\/\">MySQL management guide<\/a> and restore into a <strong>separate <code>appdb_restore<\/code> database<\/strong>. Compare rows, Unicode text and required objects. An application-database dump does not contain its users and grants; manage those securely and separately.<\/p>\n<p>For a startup failure, inspect <code>sudo journalctl -u mysql -n 80 --no-pager<\/code> and your configuration changes. Do not delete or reinitialize an existing data directory. Restore the saved configuration when appropriate; database downgrades or data-format conversions are not ordinary package rollback operations.<\/p>\n<h2>Sources<\/h2>\n<ul>\n<li><a href=\"https:\/\/dev.mysql.com\/doc\/mysql-apt-repo-quick-guide\/en\/\" rel=\"nofollow noopener\" target=\"_blank\">Oracle: installation with the MySQL APT repository<\/a><\/li>\n<li><a href=\"https:\/\/docs.oracle.com\/cd\/E17952_01\/mysql-8.4-en\/create-user.html\" rel=\"nofollow noopener\" target=\"_blank\">MySQL 8.4: CREATE USER and password options<\/a><\/li>\n<li><a href=\"https:\/\/docs.oracle.com\/cd\/E17952_01\/mysql-8.4-en\/grant.html\" rel=\"nofollow noopener\" target=\"_blank\">MySQL 8.4: GRANT and privilege scope<\/a><\/li>\n<li><a href=\"https:\/\/docs.oracle.com\/cd\/E17952_01\/mysql-8.4-en\/charset-unicode-utf8mb4.html\" rel=\"nofollow noopener\" target=\"_blank\">MySQL 8.4: the utf8mb4 character set<\/a><\/li>\n<li><a href=\"https:\/\/ubuntu.com\/about\/release-cycle\" rel=\"nofollow noopener\" target=\"_blank\">Ubuntu release and support periods<\/a><\/li>\n<\/ul>\n<p class=\"fc-article-review-date\">Technical content and sources reviewed on October 4, 2026. Recheck the relevant official documentation when a version or provider changes.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Install MySQL 8.4 LTS on Ubuntu 24.04: verify the official APT source, create a restricted application account and check Unicode data and backups.<\/p>\n","protected":false},"author":1,"featured_media":2511,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[80,96,100],"class_list":["post-1341","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials-en","tag-databases","tag-linux","tag-ubuntu"],"lang":"en","translations":{"en":1341,"tr":1236},"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/posts\/1341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/comments?post=1341"}],"version-history":[{"count":14,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/posts\/1341\/revisions"}],"predecessor-version":[{"id":1361,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/posts\/1341\/revisions\/1361"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/media\/2511"}],"wp:attachment":[{"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/media?parent=1341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/categories?post=1341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/tags?post=1341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}