{"id":12508,"date":"2025-12-20T09:51:09","date_gmt":"2025-12-20T04:21:09","guid":{"rendered":"https:\/\/www.youstable.com\/blog\/?p=12508"},"modified":"2025-12-20T09:51:23","modified_gmt":"2025-12-20T04:21:23","slug":"install-mysql-on-linux-server","status":"publish","type":"post","link":"https:\/\/www.youstable.com\/blog\/install-mysql-on-linux-server","title":{"rendered":"How to Install MySQL on Linux Server (Step-by-Step Guide 2026)"},"content":{"rendered":"\n<p><strong>To install MySQL on a Linux server<\/strong>, update your package index, install the MySQL Server package, start and enable the service, run mysql_secure_installation to harden security, and create a database and user. On Ubuntu\/Debian, use apt; on RHEL\/CentOS\/Rocky\/AlmaLinux, use dnf\/yum or the official MySQL repository for the latest version.<\/p>\n\n\n\n<p>Installing MySQL on a Linux server is straightforward when you follow the right steps. In this guide, you\u2019ll learn how to install MySQL on Ubuntu\/Debian and RHEL-based distributions, secure it for production, <a href=\"https:\/\/www.youstable.com\/blog\/how-to-enable-ssh-access-for-clients-or-users\/\">enable remote access<\/a>, tune basic performance, and verify everything works\u2014using commands you can copy and run safely. This tutorial reflects hands-on, real-world practices used on client servers at YouStable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"prerequisites-and-system-requirements\"><strong>Prerequisites and System Requirements<\/strong><\/h2>\n\n\n\n<p>Before you begin, ensure your Linux server meets basic requirements and you have the right access.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Root or sudo privileges on the server.<\/li>\n\n\n\n<li>Supported distribution: Ubuntu 20.04\/22.04\/24.04; Debian 11\/12; RHEL\/CentOS 7\/8\/9; Rocky\/AlmaLinux 8\/9.<\/li>\n\n\n\n<li>Network access to package repositories and port 3306 (if remote clients will connect).<\/li>\n\n\n\n<li>At least 1 GB RAM for small workloads; 2 GB+ recommended for production.<\/li>\n\n\n\n<li>Accurate server time (NTP) to avoid replication\/TLS issues.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"choose-the-right-mysql-edition-and-repository\"><strong>Choose the Right MySQL Edition and Repository<\/strong><\/h2>\n\n\n\n<p>Most Linux repositories provide either MySQL or MariaDB. For the latest MySQL 8 features, consider the official MySQL repository. If stability with distro integration is preferred, use the default repositories. Decide based on application requirements, driver compatibility, and long-term maintenance goals.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"mysql-vs-mariadb-quick-callout\"><strong>MySQL vs. MariaDB (Quick Callout)<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>MySQL 8.0: Strong JSON, window functions, roles, default caching_sha2_password authentication, InnoDB-centric.<\/li>\n\n\n\n<li>MariaDB: Community-driven fork, often ships by default in RHEL-like distros, slightly different features and system variables.<\/li>\n\n\n\n<li>Tip: Match your choice with app requirements. Not all features and replication behaviors are interchangeable.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"install-mysql-on-ubuntu-debian\"><strong>Install MySQL on Ubuntu\/Debian<\/strong><\/h2>\n\n\n\n<p>On Debian-based distributions, you can <a href=\"https:\/\/www.youstable.com\/blog\/install-mysql-on-linux-server\/\">install the repository default MySQL server<\/a> (often MySQL 8 on newer Ubuntu) or use Oracle\u2019s APT repo for the latest GA release.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"option-a-install-mysql-from-ubuntu-debian-repositories\"><strong>Option A: Install MySQL from Ubuntu\/Debian Repositories<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install -y mysql-server\nsudo systemctl enable --now mysql\nsudo systemctl status mysql --no-pager<\/code><\/pre>\n\n\n\n<p>Run the secure installation script to set a root password, remove test databases, and disallow anonymous users:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql_secure_installation<\/code><\/pre>\n\n\n\n<p>Depending on the distribution, the MySQL root user may authenticate via socket (no password) or via a password. If you need <a href=\"https:\/\/www.youstable.com\/blog\/ssh-keys-vs-password-authentication\/\">password authentication<\/a>, set it explicitly after logging in with sudo:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql\nALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'StrongRootPass#2025';\nFLUSH PRIVILEGES;\nEXIT;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"option-b-install-latest-mysql-8-via-official-apt-repository\"><strong>Option B: Install Latest MySQL 8 via Official APT Repository<\/strong><\/h3>\n\n\n\n<p>For the most recent MySQL GA release and tools like MySQL Shell, use the Oracle APT repo:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/dev.mysql.com\/get\/mysql-apt-config_0.8.29-1_all.deb\nsudo dpkg -i mysql-apt-config_0.8.29-1_all.deb   # Select MySQL Server &amp; Tools\nsudo apt update\nsudo apt install -y mysql-server\nsudo systemctl enable --now mysql<\/code><\/pre>\n\n\n\n<p>Replace the version of the APT config package with the latest from dev.mysql.com. Then run the secure installation as shown earlier.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"install-mysql-on-rhel-centos-rocky-almalinux\"><strong>Install MySQL on RHEL\/CentOS\/Rocky\/AlmaLinux<\/strong><\/h2>\n\n\n\n<p>RHEL-like systems may ship MariaDB by default. To ensure you\u2019re installing MySQL, use the MySQL Yum repository or the AppStream module if available.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"option-a-use-official-mysql-yum-dnf-repository\"><strong>Option A: Use Official MySQL Yum\/DNF Repository<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Download and install the MySQL repo package (example for EL8\/EL9)\nsudo dnf install -y https:\/\/dev.mysql.com\/get\/mysql80-community-release-el9-1.noarch.rpm\nsudo dnf module disable -y mysql mariadb || true\nsudo dnf clean all\nsudo dnf install -y mysql-community-server\n\nsudo systemctl enable --now mysqld\nsudo systemctl status mysqld --no-pager<\/code><\/pre>\n\n\n\n<p>On first start, MySQL may generate a temporary root password in the log. Retrieve it and then run the secure installation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo grep 'temporary password' \/var\/log\/mysqld.log\nsudo mysql_secure_installation<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"option-b-use-appstream-module-if-mysql-8-is-available\"><strong>Option B: Use AppStream Module (If MySQL 8 Is Available)<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf module list mysql\nsudo dnf module enable -y mysql:8.0\nsudo dnf install -y @mysql\nsudo systemctl enable --now mysqld<\/code><\/pre>\n\n\n\n<p>Confirm the service is running and secure it as above.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"initial-configuration-and-best-practices\"><strong>Initial Configuration and Best Practices<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"create-a-database-and-a-least-privilege-user\"><strong>Create a Database and a Least-Privilege User<\/strong><\/h3>\n\n\n\n<p>Use a dedicated user per application with minimal privileges. Replace placeholders with your values.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql -u root -p\n\n-- Inside MySQL shell:\nCREATE DATABASE appdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\nCREATE USER 'appuser'@'localhost' IDENTIFIED BY 'StrongAppPass#2025';\nGRANT ALL PRIVILEGES ON appdb.* TO 'appuser'@'localhost';\nFLUSH PRIVILEGES;\nEXIT;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"authentication-plugin-considerations\"><strong>Authentication Plugin Considerations<\/strong><\/h3>\n\n\n\n<p>MySQL 8 defaults to caching_sha2_password. Some older clients only support mysql_native_password. If needed, set it per user (not globally) to avoid weakening security for all accounts:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER USER 'appuser'@'localhost'\n  IDENTIFIED WITH mysql_native_password BY 'StrongAppPass#2025';\nFLUSH PRIVILEGES;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"enable-remote-access-optional\"><strong>Enable Remote Access (Optional)<\/strong><\/h3>\n\n\n\n<p>Allow remote access only when necessary and restrict by IP. Update bind-address and firewall accordingly.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ubuntu\/Debian config file: \/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/li>\n\n\n\n<li>RHEL-like config file: \/etc\/my.cnf or \/etc\/my.cnf.d\/mysqld.cnf<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code># In the &#91;mysqld] section:\nbind-address = 0.0.0.0\n# or comment the bind-address line to listen on all interfaces<\/code><\/pre>\n\n\n\n<p>Restart MySQL and create a user restricted to your application server\u2019s IP:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart mysql   # Ubuntu\/Debian\n# or\nsudo systemctl restart mysqld  # RHEL-like\n\nsudo mysql -u root -p\nCREATE USER 'appuser'@'203.0.113.10' IDENTIFIED BY 'StrongAppPass#2025';\nGRANT ALL PRIVILEGES ON appdb.* TO 'appuser'@'203.0.113.10';\nFLUSH PRIVILEGES;\nEXIT;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"open-firewall-port-3306-if-remote-access-needed\"><strong>Open Firewall Port 3306 (If Remote Access Needed)<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># UFW (Ubuntu):\nsudo ufw allow from 203.0.113.10 to any port 3306 proto tcp\n\n# firewalld (RHEL-like):\nsudo firewall-cmd --add-rich-rule='rule family=\"ipv4\" source address=\"203.0.113.10\" port protocol=\"tcp\" port=\"3306\" accept' --permanent\nsudo firewall-cmd --reload<\/code><\/pre>\n\n\n\n<p>Use IP allowlisting instead of opening 3306 to the world. If SELinux is enforcing, allow MySQL to connect over the network where relevant:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Example SELinux adjustment (if needed for network access):\nsudo setsebool -P mysql_connect_any 1<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"verify-installation-and-troubleshoot-quickly\"><strong>Verify Installation and Troubleshoot Quickly<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"check-version-and-service-health\"><strong>Check Version and Service Health<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql --version\nsystemctl status mysql   # Ubuntu\/Debian\nsystemctl status mysqld  # RHEL-like\n\n# Connect and show databases\nmysql -u root -p -e \"SHOW DATABASES;\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"logs-and-common-issues\"><strong>Logs and Common Issues<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log files: \/var\/log\/mysql\/error.log (Ubuntu\/Debian), \/var\/log\/mysqld.log (RHEL-like).<\/li>\n\n\n\n<li>Port in use: Ensure no other service is bound to 3306 (use ss -lntp | grep 3306).<\/li>\n\n\n\n<li>Auth errors: Confirm the correct plugin, host (e.g., localhost vs %), and password.<\/li>\n\n\n\n<li>Memory: For small servers, reduce buffer sizes to avoid OOM kills.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"basic-performance-tuning-safe-defaults\"><strong>Basic Performance Tuning (Safe Defaults)<\/strong><\/h3>\n\n\n\n<p>Start conservatively on small servers and adjust based on workload and the slow query log.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Add to mysqld section (paths differ by distro)\ninnodb_buffer_pool_size = 512M\ninnodb_log_file_size    = 256M\ninnodb_flush_log_at_trx_commit = 1\nmax_connections         = 200\nthread_cache_size       = 50\nquery_cache_type        = 0    # MySQL 8 ignores query cache; ensure disabled\nslow_query_log          = 1\nslow_query_log_file     = \/var\/log\/mysql\/slow.log\nlong_query_time         = 1<\/code><\/pre>\n\n\n\n<p>After changes, restart MySQL and monitor performance using SHOW GLOBAL STATUS, slow logs, and application response times.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"backups-and-maintenance\"><strong>Backups and Maintenance<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"logical-backups-mysqldump-mysqlpump\"><strong>Logical Backups (mysqldump\/mysqlpump)<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Backup one database\nmysqldump -u root -p --routines --triggers --single-transaction appdb &gt; appdb_$(date +%F).sql\n\n# Restore\nmysql -u root -p appdb &lt; appdb_YYYY-MM-DD.sql<\/code><\/pre>\n\n\n\n<p>For large datasets or point-in-time recovery, consider MySQL Enterprise Backup or Percona XtraBackup (physical backups). Always test restores.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"updates-and-patching\"><strong>Updates and Patching<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Schedule maintenance windows for minor version upgrades.<\/li>\n\n\n\n<li>Back up before patching.<\/li>\n\n\n\n<li>Ubuntu\/Debian: sudo apt update &amp;&amp; sudo apt upgrade.<\/li>\n\n\n\n<li>RHEL-like: sudo dnf update or sudo yum update.<\/li>\n\n\n\n<li>Review release notes for authentication or replication changes.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"secure-mysql-for-production\"><strong>Secure MySQL for Production<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run mysql_secure_installation and set strong, unique passwords.<\/li>\n\n\n\n<li>Disable remote root login; create admin users restricted by IP.<\/li>\n\n\n\n<li>Use TLS for client connections (configure ssl_cert, ssl_key, ssl_ca in mysqld).<\/li>\n\n\n\n<li>Grant least privileges; avoid GRANT ALL on *.* for app users.<\/li>\n\n\n\n<li>Rotate credentials and remove unused accounts\/databases.<\/li>\n\n\n\n<li>Enable slow query log and review regularly.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"real-world-example-app-plus-db-on-separate-servers\"><strong>Real-World Example: App + DB on Separate Servers<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create app user restricted to the app server\u2019s IP.<\/li>\n\n\n\n<li>Open port 3306 only for that IP (UFW or firewalld).<\/li>\n\n\n\n<li>Bind MySQL to 0.0.0.0 and enforce TLS for production traffic.<\/li>\n\n\n\n<li>Monitor connections with performance_schema and logins in error logs.<\/li>\n\n\n\n<li>Set consistent server time (NTP) for accurate logs and backups.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"when-to-choose-managed-hosting-or-expert-help\"><strong>When to Choose Managed Hosting or Expert Help<\/strong><\/h2>\n\n\n\n<p>If you\u2019d rather focus on your application than database upkeep, consider <a href=\"https:\/\/www.youstable.com\/blog\/benefits-of-fully-managed-dedicated-server\/\">managed servers or optimized hosting<\/a>. YouStable\u2019s hosting plans are tuned for MySQL-based apps and include guidance on secure configuration, performance tuning, and backup strategy\u2014ideal for WordPress, LAMP\/LEMP stacks, and SaaS workloads.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"complete-command-cheat-sheet\"><strong>Complete Command Cheat Sheet<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># Ubuntu\/Debian quick install\nsudo apt update &amp;&amp; sudo apt install -y mysql-server\nsudo systemctl enable --now mysql\nsudo mysql_secure_installation\n\n# RHEL\/CentOS\/Rocky\/Alma quick install (MySQL repo)\nsudo dnf install -y https:\/\/dev.mysql.com\/get\/mysql80-community-release-el9-1.noarch.rpm\nsudo dnf module disable -y mysql mariadb || true\nsudo dnf install -y mysql-community-server\nsudo systemctl enable --now mysqld\nsudo mysql_secure_installation\n\n# Create DB and user\nsudo mysql -u root -p -e \"\nCREATE DATABASE appdb;\nCREATE USER 'appuser'@'localhost' IDENTIFIED BY 'StrongAppPass#2025';\nGRANT ALL PRIVILEGES ON appdb.* TO 'appuser'@'localhost';\nFLUSH PRIVILEGES;\"\n\n# Open firewall for one host (examples)\nsudo ufw allow from 203.0.113.10 to any port 3306 proto tcp\nsudo firewall-cmd --add-rich-rule='rule family=\"ipv4\" source address=\"203.0.113.10\" port protocol=\"tcp\" port=\"3306\" accept' --permanent\nsudo firewall-cmd --reload<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"faqs-install-mysql-on-linux-server\"><strong>FAQs: Install MySQL on Linux Server<\/strong><\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1765521021017\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-install-mysql-on-ubuntu\"><strong>How do I install MySQL on Ubuntu?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Run sudo apt update, then sudo apt install -y mysql-server. Enable and start the service with sudo systemctl enable &#8211;now mysql. Finally, secure it with sudo mysql_secure_installation. For the newest MySQL 8, add Oracle\u2019s APT repo from dev.mysql.com before installing.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765521029967\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"what-is-the-default-mysql-root-password-on-linux\"><strong>What is the default MySQL root password on Linux?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>On Ubuntu\/Debian, root may authenticate via socket (no password) or prompt you to set one during mysql_secure_installation. On RHEL-like systems using the MySQL repo, a temporary root password is logged in \/var\/log\/mysqld.log after first start.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765521038771\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-enable-remote-connections-to-mysql\"><strong>How do I enable remote connections to MySQL?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Edit MySQL config to listen on 0.0.0.0 (bind-address), add a user restricted to your client\u2019s IP, and open port 3306 on the firewall only for that IP. Restart MySQL and test with mysql -h DB_HOST -u USER -p. Always avoid exposing 3306 publicly.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765521048730\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"is-mysql-or-mariadb-better-for-linux-servers\"><strong>Is MySQL or MariaDB better for Linux servers?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Both are solid. Choose MySQL 8 for the latest Oracle-supported features and broad ecosystem compatibility. Choose MariaDB if you prefer community-driven development or it\u2019s the default in your distro. Verify your application\u2019s driver support before switching.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765521057509\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-can-i-completely-remove-mysql-from-linux\"><strong>How can I completely remove MySQL from Linux?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>On Ubuntu\/Debian: sudo apt purge -y mysql-server mysql-common; then sudo apt autoremove -y and remove residual data in \/var\/lib\/mysql (after backups). On RHEL-like: sudo dnf remove -y mysql* and clean any remaining config files, then delete \/var\/lib\/mysql if appropriate.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765521066448\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-reset-a-lost-mysql-root-password\"><strong>How do I reset a lost MySQL root password?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Stop MySQL, start it with &#8211;skip-grant-tables, connect without a password, update the root <a href=\"https:\/\/www.youstable.com\/blog\/change-a-database-user-password-in-directadmin\/\">user\u2019s password<\/a>, then restart normally. Follow official MySQL 8 documentation for exact steps on your distro. Ensure you restrict server access during the process.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765521075412\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"what-port-does-mysql-use-and-should-i-change-it\"><strong>What port does MySQL use, and should I change it?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>MySQL uses TCP port 3306. You can change it, but security should rely on strong authentication, TLS, firewalls, and IP allowlisting. If you change the port, update firewalls, SELinux, and application connection strings accordingly.<\/p>\n<p>With these steps, you can confidently install MySQL on a Linux server, secure it, and prepare it for production workloads. If you want expert-backed hosting that\u2019s tuned for MySQL and WordPress, YouStable can help you deploy, optimize, and maintain your stack with best practices from day one.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>To install MySQL on a Linux server, update your package index, install the MySQL Server package, start and enable the [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":15428,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"iawp_total_views":0,"footnotes":""},"categories":[350],"tags":[],"class_list":["post-12508","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledgebase"],"acf":[],"featured_image_src":"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/How-to-Install-MySQL-on-Linux-Server.jpg","author_info":{"display_name":"Prahlad Prajapati","author_link":"https:\/\/www.youstable.com\/blog\/author\/prahladblog"},"_links":{"self":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/12508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/comments?post=12508"}],"version-history":[{"count":4,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/12508\/revisions"}],"predecessor-version":[{"id":15429,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/12508\/revisions\/15429"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media\/15428"}],"wp:attachment":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media?parent=12508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/categories?post=12508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/tags?post=12508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}