DEV Community

Oluwafemi Lawal
Oluwafemi Lawal

Posted on • Updated on

MySQL Installation Error On WSL 1

Welcome to my first post on dev.to! My goal is to share my experiences and solutions, hoping it might help someone out there facing similar challenges. As I continue to refine my posts, I appreciate your understanding and patience.

The Challenge

While setting up MySQL on WSL, I encountered the following error:

mysqld is running as pid 2657
sleep: cannot read realtime clock: Invalid argument
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Enter fullscreen mode Exit fullscreen mode

The error is caused by things being not properly installed/set up, so the solution involves basically uninstalling and reinstalling Mysql related packages.

Step 1: Begin by purging all related MySQL packages:

sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get dist-upgrade
Enter fullscreen mode Exit fullscreen mode

Alternative for Step 1 (if the above doesn't work):

sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server
Enter fullscreen mode Exit fullscreen mode

Step 2: Update and upgrade your system:

sudo apt update && sudo apt dist-upgrade && sudo apt autoremove && sudo apt -f install
Enter fullscreen mode Exit fullscreen mode

Step 3: Reinstall MySQL:

sudo apt install mysql-server
Enter fullscreen mode Exit fullscreen mode

I hope this guide helps you navigate and resolve similar MySQL issues on WSL. Let's continue to learn and share together!

Top comments (0)