Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
VGSources
Blog

How to Fix a MySQL Server That Won’t Start on CentOS

Find the real cause behind a failed mysqld.service start on CentOS, repair the exact filesystem or SELinux issue, resolve port conflicts, and verify a clean restart.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A failed systemd start is only a symptom. The reliable fix is to preserve the failure output, read the MySQL error log, then correct the specific resource named there: the data directory, a log or socket path, the listening port, or an SELinux policy rule.

Use the service unit installed on your machine. Oracle MySQL packages commonly use mysqld.service, while MariaDB and some CentOS packages use mariadb.service or mysql.service. Replace mysqld in the commands below when your unit has another name.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the failed start message actually means

Messages such as Job for mysqld.service failed because the control process exited with error code do not identify the cause. They report that the service’s startup process returned a non-zero status. The useful explanation is normally in the unit journal and in MySQL’s own error log.

CentOS installations differ by release and by whether Oracle MySQL, MariaDB, or a Software Collections package is installed. Confirm the package and unit before changing files or permissions:

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
systemctl list-unit-files | grep -E 'mysqld|mysql|mariadb'
rpm -qa | grep -Ei 'mysql|mariadb'

Do not repeatedly restart the service while guessing. Each attempt can add noise to the journal and can obscure the first, most specific error.

Collect evidence before changing anything

Run the following as a user with permission to inspect the service and logs. Save the output in a ticket or text file so you can compare it after the repair.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Check the unit status.
    systemctl status mysqld --no-pager

    Record the exit status, the command systemd ran, recent log lines, and any referenced path.

  2. Read the unit-specific journal.
    journalctl -u mysqld -n 100 --no-pager

    This is usually clearer than a system-wide journal query. If the status output directs you to extended journal details, also run journalctl -xe and capture the lines for this unit.

  3. Inspect the unit definition and overrides.
    systemctl cat mysqld

    Look for an alternate configuration file, a custom --datadir, an environment file, or a different user account.

  4. Note the time and exact wording. Errors such as Errcode 13, Address already in use, a missing directory, or an SELinux AVC denial point to different fixes. Do not paraphrase them before investigating.

Find and read the MySQL error log

MySQL’s documented first troubleshooting step is to check the error log to see why the server does not start. The active location is determined by the configuration, not by a universal CentOS filename. Search the configuration files for the server’s paths:

grep -RniE '^(datadir|log_error|log-error|socket|port|pid-file)' /etc/my.cnf /etc/my.cnf.d 2>/dev/null

Then open the final lines of the configured error log, for example:

tail -n 100 /path/from/log_error

If the configured file does not exist, check its parent directory and the journal for an earlier message explaining why it could not be created. A log path outside the default locations can fail for the same ownership or SELinux reasons as a moved data directory.

Read the last startup block as a group. The first filesystem, permission, bind, or initialization error is usually more useful than later messages saying that startup aborted.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Confirm the active configuration

A server must know its data directory because it uses that location as the working area for databases, logs, and the PID file. It must also have consistent values for the socket, TCP port, and error log. A configuration edit can leave the service pointing at an old directory or at a path that exists but is not accessible.

Check every effective value shown in the configuration, including files included by my.cnf. For each path, verify that it exists, is the path you intended, and is not a relative path whose meaning changes under systemd. If you recently moved /var/lib/mysql, changed datadir, or changed the port, treat that change as the leading suspect.

Do not assume that a client command’s defaults match the server. A client may try a different socket or port than the daemon is configured to use, producing a connection failure even after the server has started.

Repair data-directory and log-path permissions

The MySQL service account must be able to traverse the parent directories and read and modify the data directory and its contents. MySQL documents Errcode 13 as Permission denied: the directory privileges do not permit server access. Unix ownership can look correct on the final directory while a parent directory blocks traversal.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect the complete path

ls -ld /path/to/datadir
namei -om /path/to/datadir
find /path/to/datadir -maxdepth 2 -printf '%M %u:%g %pn' | head -n 100

Use the actual path from the active configuration. The service account is commonly named mysql, but confirm it in the unit file rather than assuming it. Check the owner and group of the directory, database files, redo or undo files, socket directory, PID directory, and error-log directory.

Apply the narrow correction

If the files belong to the wrong account because they were copied as root or restored from another host, correct ownership for the service account:

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
chown -R mysql:mysql /path/to/datadir

Run that only after confirming the path. A typo in a recursive ownership command can damage unrelated files. Preserve restrictive permissions appropriate to your installation; do not make the database world-writable as a shortcut.

For a custom log or socket directory, fix its owner and the execute permission on every parent directory as well. If the service is configured to run under a non-default account, use that account and group instead of mysql:mysql.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not run mysqld as root as a routine fix

Starting the daemon manually as root may hide an ownership problem and can create new files that the normal service account cannot later modify. Correct the resource and let systemd start the server under its configured service identity.

Check SELinux separately from Unix permissions

On an enforcing CentOS or RHEL-family system, correct owner and mode bits are not sufficient. SELinux can deny access to a custom data directory, log path, socket, or port even when ls -l looks perfect.

Confirm enforcement and look for a denial

getenforce
ausearch -m avc -ts recent
grep "denied" /var/log/audit/audit.log | tail -n 50

Run the audit query immediately after a failed start so that the relevant denial is near the end. Match its timestamp and path to the startup attempt. A denial that names name_bind concerns a port; one naming a file or directory concerns its label or access.

Inspect labels on a custom data directory

ls -Zd /path/to/datadir
semanage fcontext -l | grep -i mysql

The default MySQL data directory is /var/lib/mysql/, and MySQL’s SELinux policy identifies the database-file type as mysqld_db_t. A moved directory normally retains an inappropriate label unless you assign a persistent file-context rule and restore the labels.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

For a custom location, use the policy supplied by your distribution. A typical persistent rule for a data tree is:

semanage fcontext -a -t mysqld_db_t '/srv/mysql(/.*)?'
restorecon -Rv /srv/mysql

Substitute the real path and confirm the type expected by your installed policy. If a rule already exists, modify it rather than adding a duplicate. Apply equivalent policy guidance for custom log or socket locations when the audit record identifies them.

Do not leave the whole machine in permissive mode to make the service start. That removes the protection instead of fixing the mislabeled resource. If semanage is unavailable, install or enable the distribution’s SELinux management tools according to its package documentation, then make the rule persistent.

Resolve port and socket conflicts

MySQL’s documented default TCP port is 3306. A second database process, another application, or a stale service can already be listening there. The same problem can occur with the Unix socket named in the configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the configured TCP port

ss -ltnp | grep ':3306'
lsof -i :3306

Replace 3306 with the configured port. Identify the owning process and its systemd unit. If another MySQL instance is already running, stop or reconfigure the intended instance through its own service definition; do not kill an unfamiliar process merely because its name contains “mysql.”

Check the Unix socket

ss -lxnp
ls -l /path/from/socket

A stale socket file can remain after an unclean shutdown, but deleting it blindly can remove a socket belonging to a live process. First verify that no mysqld process is using it and that the configured socket directory is writable by the service account. Then remove only the stale file and retry the service.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

When a non-default port is intentional

If you changed the port to a value such as 3307, update both clients and SELinux policy. MySQL documents that an unapproved non-default port can produce an AVC name_bind denial and prevent startup. On systems using the standard SELinux policy, the port must be labeled with mysqld_port_t; use the policy’s port-management command and verify the result before restarting. For example:

semanage port -l | grep mysqld
semanage port -a -t mysqld_port_t -p tcp 3307

If the port is already defined, use the policy tool’s modify operation instead of adding a duplicate. Confirm that the value in the configuration, the firewall rule, and the client connection string all agree.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use the error message to choose the fix

Observed symptom Resource to inspect What to verify Likely narrow correction
Errcode 13 or Permission denied Data directory, log, socket, or parent directory Service-account ownership, mode bits, and traversal permission Correct the owner/group and restrictive modes; do not run mysqld as root
Path does not exist or cannot be created datadir, log_error, PID, or socket path Every component exists and matches the active configuration Create or correct only the intended directory, then set ownership and policy labels
Address already in use Configured TCP port or Unix socket Process and unit currently holding the endpoint Stop the duplicate service, choose a free endpoint, or correct the configuration
SELinux AVC involving a file or directory Custom data, log, or socket path ls -Z output and recent audit record Assign the distribution’s persistent file context and run restorecon
SELinux name_bind denial Non-default TCP port Port number and mysqld_port_t policy entry Label the intended port, then retry
Service starts but a client cannot connect Client socket, host, or port Client defaults versus server’s active values Use the matching socket or port and verify local connectivity

Special procedure after moving /var/lib/mysql

A datadir move changes more than one variable. Before restarting, confirm the new path in the active configuration, stop any old instance, and check that the new tree contains the expected database files. Verify all of the following in this order:

  1. The directory exists and is on the filesystem you intended to use.
  2. The service account can traverse every parent directory.
  3. The data files and subdirectories have the service account’s ownership.
  4. The SELinux label is appropriate for a MySQL data tree, with a persistent rule for the custom path.
  5. The error-log and PID-file locations are writable and are not still pointing into the old tree.
  6. No second mysqld process is using the old socket or port.

If the old directory was renamed rather than copied, a configuration include may still override your new setting. Use systemctl cat and a recursive configuration search to find the effective value instead of editing the first file you happen to open.

Restart and verify in layers

Once the evidence identifies a specific correction, restart the unit and immediately repeat the checks. Do not treat a successful systemd return code as proof that applications can connect.

  1. Restart the correct unit.
    systemctl restart mysqld
  2. Check active state and recent journal lines.
    systemctl is-active mysqld
    systemctl status mysqld --no-pager
    journalctl -u mysqld -n 50 --no-pager
  3. Read the newest error-log block. Confirm that startup completed without a new permission, bind, or initialization error.
  4. Confirm the endpoint.
    ss -ltnp | grep ':3306'
    ss -lxnp

    Use the configured port and socket rather than assuming the defaults.

  5. Test a local client connection.
    mysql --protocol=socket -uroot -p

    Use the configured socket explicitly if it is not the default. A successful authentication test demonstrates that the daemon is running and accepting local connections, not merely that systemd considers the process alive.

Record the before-and-after status, journal excerpt, error-log result, endpoint check, and client test. That record distinguishes a repaired startup from a temporary process that fails again under load.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common mistakes that make the outage worse

  • Repeating systemctl restart without reading logs: this creates more failed attempts without identifying the resource at fault.
  • Changing every permission to 777: it weakens the host and does not correct an SELinux denial.
  • Using setenforce 0 as the final fix: permissive mode hides policy errors and leaves the service unprotected.
  • Deleting a socket or PID file while mysqld is running: you can disrupt the healthy instance that owns it.
  • Editing only /etc/my.cnf: included files or a systemd override may provide the value that actually wins.
  • Running initialization or the server manually as root: root-owned files commonly cause the next normal systemd start to fail.
  • Assuming “CentOS” implies one package layout: Oracle MySQL, MariaDB, and release-specific packages can use different units, paths, and policy details.

When the cause is still unclear

Escalate with evidence rather than a generic “MySQL will not start” report. Include the exact unit name and package, the output of systemctl status, the last 100 unit-journal lines, the final error-log block, the active values for datadir, log_error, socket, and port, ownership and mode output for each affected path, SELinux status and matching AVC records, and the port/socket checks.

That bundle lets an administrator distinguish a filesystem problem from policy enforcement, endpoint contention, or a configuration mismatch without asking you to repeat destructive trial-and-error. If the data directory itself may be damaged, stop changing files and obtain a backup or specialist review before attempting recovery operations.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.