{"id":347,"date":"2025-06-17T07:53:38","date_gmt":"2025-06-17T02:23:38","guid":{"rendered":"https:\/\/griffso.com\/blogs\/?p=347"},"modified":"2025-06-17T07:53:50","modified_gmt":"2025-06-17T02:23:50","slug":"fix-xampp-mysql-not-starting-or-crashing-windows-macos-linux","status":"publish","type":"post","link":"https:\/\/griffso.com\/blogs\/fix-xampp-mysql-not-starting-or-crashing-windows-macos-linux\/","title":{"rendered":"Fix XAMPP MySQL Not Starting or Crashing (Windows, macOS, Linux)"},"content":{"rendered":"\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Fix XAMPP MySQL Not Starting or Crashing (Windows, macOS, Linux)<\/strong><\/h2>\n\n\n\n<p>MySQL not starting or crashing in XAMPP? Fix common issues like port conflicts, corrupted files, or configuration errors on Windows, macOS, and Linux\/Ubuntu with this step-by-step guide.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83e\udde9 <strong>Introduction<\/strong><\/h3>\n\n\n\n<p>If you&#8217;re unable to start MySQL in XAMPP, or it starts and then shuts down immediately, don&#8217;t worry\u2014this is a common problem with clear fixes. It usually happens due to <strong>port conflicts<\/strong>, <strong>incomplete shutdown<\/strong>, or <strong>corrupt data files<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u2757 Common Causes<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Port 3306 is already in use<\/li>\n\n\n\n<li>Improper shutdown causing corrupted <code>ibdata1<\/code><\/li>\n\n\n\n<li>Conflicting services (like MySQL from another software)<\/li>\n\n\n\n<li>Misconfigured <code>my.cnf<\/code> or <code>my.ini<\/code><\/li>\n\n\n\n<li>Lack of permissions (especially on Linux\/macOS)<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udda5\ufe0f <strong>Fix on Windows<\/strong><\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">\u2705 Step-by-Step:<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Check Which Port Is in Use:<\/strong> <code>netstat -ano | findstr :3306<\/code> If another process is using it, identify and stop it.<\/li>\n\n\n\n<li><strong>Stop Conflicting MySQL Services:<\/strong><br>Go to: <code>Services > Look for MySQL or MariaDB<\/code> Stop it, or uninstall if not needed.<\/li>\n\n\n\n<li><strong>Edit MySQL Port in <code>my.ini<\/code>:<\/strong><br>XAMPP Control Panel > MySQL > Config > <code>my.ini<\/code> Change: <code>port=3306<\/code> To: <code>port=3307<\/code><\/li>\n\n\n\n<li><strong>Delete Corrupted Log\/Data Files (only if MySQL was shut improperly):<\/strong>\n<ul class=\"wp-block-list\">\n<li>Go to: <code>C:\\xampp\\mysql\\data<\/code><\/li>\n\n\n\n<li>Backup and then delete:\n<ul class=\"wp-block-list\">\n<li><code>ib_logfile0<\/code><\/li>\n\n\n\n<li><code>ib_logfile1<\/code><\/li>\n\n\n\n<li><code>ibdata1<\/code> <em>(Warning: causes data loss, backup first)<\/em><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Restart XAMPP as Administrator<\/strong><br>Then try starting MySQL again.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83c\udf4f <strong>Fix on macOS<\/strong><\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">\u2705 Step-by-Step:<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Check Port Usage:<\/strong> <code>sudo lsof -i :3306<\/code> If MySQL is running from another app (like MAMP), stop it: <code>sudo pkill mysqld<\/code><\/li>\n\n\n\n<li><strong>Change MySQL Port:<\/strong><br>Open: <code>\/Applications\/XAMPP\/xamppfiles\/etc\/my.cnf<\/code> Change: <code>port=3306<\/code> to: <code>port=3307<\/code><\/li>\n\n\n\n<li><strong>Clear Lock Files (optional):<\/strong> <code>sudo rm -f \/Applications\/XAMPP\/xamppfiles\/var\/mysql\/*.err<\/code><\/li>\n\n\n\n<li><strong>Fix Permissions:<\/strong> <code>sudo chown -R _mysql:_mysql \/Applications\/XAMPP\/xamppfiles\/var\/mysql\/<\/code><\/li>\n\n\n\n<li><strong>Restart Apache and MySQL via XAMPP Manager.<\/strong><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udc27 <strong>Fix on Linux\/Ubuntu<\/strong><\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">\u2705 Step-by-Step:<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Kill Conflicting Process:<\/strong> <code>sudo lsof -i :3306 sudo kill -9 [PID]<\/code><\/li>\n\n\n\n<li><strong>Change Port in <code>my.cnf<\/code>:<\/strong> <code>sudo nano \/opt\/lampp\/etc\/my.cnf<\/code> Change: <code>port=3306<\/code> to: <code>port=3307<\/code><\/li>\n\n\n\n<li><strong>Fix Data Directory Permission Issues:<\/strong> <code>sudo chown -R mysql:mysql \/opt\/lampp\/var\/mysql<\/code><\/li>\n\n\n\n<li><strong>Remove Lock\/Log Files (if crashing):<\/strong> <code>sudo rm \/opt\/lampp\/var\/mysql\/ib_logfile* sudo rm \/opt\/lampp\/var\/mysql\/ibdata1<\/code> \u26a0\ufe0f Backup the data folder first.<\/li>\n\n\n\n<li><strong>Restart XAMPP:<\/strong> <code>sudo \/opt\/lampp\/lampp restart<\/code><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udca1 Tips to Avoid Future Issues<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Always <strong>stop MySQL<\/strong> from XAMPP panel before shutting down your system.<\/li>\n\n\n\n<li>Regularly <strong>backup<\/strong> your databases.<\/li>\n\n\n\n<li>Avoid installing multiple MySQL services.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udccc Conclusion<\/h3>\n\n\n\n<p>MySQL not starting in XAMPP can feel like a blocker, but it&#8217;s often a matter of adjusting port settings or cleaning up after an improper shutdown. Whether you&#8217;re on Windows, macOS, or Linux, the above fixes will have your MySQL running again.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udcac Still Not Working?<\/h3>\n\n\n\n<p>Paste your <code>my.ini<\/code> or MySQL error log in the comments, and I\u2019ll help you debug it step by step.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n<div class=\"pld-like-dislike-wrap pld-template-1\">\n    <div class=\"pld-like-wrap  pld-common-wrap\">\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"347\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\n                        <i class=\"fas fa-thumbs-up\"><\/i>\n                <\/a>\n    <span class=\"pld-like-count-wrap pld-count-wrap\">1    <\/span>\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\n    <a href=\"javascript:void(0)\" class=\"pld-dislike-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"347\" data-trigger-type=\"dislike\" data-restriction=\"cookie\" data-already-liked=\"0\">\n                        <i class=\"fas fa-thumbs-down\"><\/i>\n                <\/a>\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\"><\/span>\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Fix XAMPP MySQL Not Starting or Crashing (Windows, macOS, Linux) MySQL not starting or crashing in XAMPP? Fix common issues like port conflicts, corrupted files, or configuration errors on Windows, macOS, and Linux\/Ubuntu with this step-by-step guide. \ud83e\udde9 Introduction If you&#8217;re unable to start MySQL in XAMPP, or it starts and then shuts down immediately, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-347","post","type-post","status-publish","format-standard","hentry","category-coding-help-programming-tips-code-examples-coding-resources-debug-guide-software-development-learn-to-code-coding-best-practices-coding-challenges-coding-tutorials"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/griffso.com\/blogs\/wp-json\/wp\/v2\/posts\/347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/griffso.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/griffso.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/griffso.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/griffso.com\/blogs\/wp-json\/wp\/v2\/comments?post=347"}],"version-history":[{"count":1,"href":"https:\/\/griffso.com\/blogs\/wp-json\/wp\/v2\/posts\/347\/revisions"}],"predecessor-version":[{"id":348,"href":"https:\/\/griffso.com\/blogs\/wp-json\/wp\/v2\/posts\/347\/revisions\/348"}],"wp:attachment":[{"href":"https:\/\/griffso.com\/blogs\/wp-json\/wp\/v2\/media?parent=347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/griffso.com\/blogs\/wp-json\/wp\/v2\/categories?post=347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/griffso.com\/blogs\/wp-json\/wp\/v2\/tags?post=347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}