Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL Installation on Bash on Windows 10 #1332

Closed
ashishchandra opened this issue Nov 8, 2016 · 17 comments
Closed

MySQL Installation on Bash on Windows 10 #1332

ashishchandra opened this issue Nov 8, 2016 · 17 comments

Comments

@ashishchandra
Copy link

ashishchandra commented Nov 8, 2016

Please use the following bug reporting template to help produce actionable and reproducible issues. Please try to ensure that the reproduction is minimal so that the team can go through more bugs!

Trying to install MySQL on Bash on Windows 10 Creators Build (14959)

MySQL Installation

root@Ashish:~# sudo apt install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libcolord1 libcolorhug1 libgphoto2-port10 libjasper1 libv4l-0 libv4lconvert0 libvpx1 libxcb-util0 os-prober
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libaio1 libevent-core-2.0-5 libhtml-template-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common
  mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
  libipc-sharedcache-perl mailx tinyca
The following NEW packages will be installed:
  libaio1 libevent-core-2.0-5 libhtml-template-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server
  mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 9 newly installed, 0 to remove and 6 not upgraded.
1 not fully installed or removed.
Need to get 18.3 MB of archives.
After this operation, 160 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libevent-core-2.0-5 amd64 2.0.21-stable-2 [69.4 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-common all 5.7.16-0ubuntu0.16.04.1 [15.0 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 libaio1 amd64 0.3.110-2 [6,356 B]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client-core-5.7 amd64 5.7.16-0ubuntu0.16.04.1 [6,365 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client-5.7 amd64 5.7.16-0ubuntu0.16.04.1 [1,739 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server-core-5.7 amd64 5.7.16-0ubuntu0.16.04.1 [7,395 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server-5.7 amd64 5.7.16-0ubuntu0.16.04.1 [2,597 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 libhtml-template-perl all 2.95-2 [60.4 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server all 5.7.16-0ubuntu0.16.04.1 [10.1 kB]
Fetched 18.3 MB in 1min 2s (291 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libevent-core-2.0-5:amd64.
(Reading database ... 43250 files and directories currently installed.)
Preparing to unpack .../libevent-core-2.0-5_2.0.21-stable-2_amd64.deb ...
Unpacking libevent-core-2.0-5:amd64 (2.0.21-stable-2) ..............................................................]
Selecting previously unselected package mysql-common................................................................]
Preparing to unpack .../mysql-common_5.7.16-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-common (5.7.16-0ubuntu0.16.04.1) ...................................................................]
Selecting previously unselected package libaio1:amd64...............................................................]
Preparing to unpack .../libaio1_0.3.110-2_amd64.deb ...
Unpacking libaio1:amd64 (0.3.110-2) ................................................................................]
Selecting previously unselected package mysql-client-core-5.7.......................................................]
Preparing to unpack .../mysql-client-core-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.16-0ubuntu0.16.04.1) ..........................................................]
Selecting previously unselected package mysql-client-5.7............................................................]
Preparing to unpack .../mysql-client-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.16-0ubuntu0.16.04.1) ...............................................................]
Selecting previously unselected package mysql-server-core-5.7.......................................................]
Preparing to unpack .../mysql-server-core-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.16-0ubuntu0.16.04.1) ..........................................................]
Processing triggers for libc-bin (2.23-0ubuntu4) ...##..............................................................]
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-common (5.7.16-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode............]
Selecting previously unselected package mysql-server-5.7.#..........................................................]
(Reading database ... 43419 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.16-0ubuntu0.16.04.1) ...####........................................................]
Selecting previously unselected package libhtml-template-perl.##....................................................]
Preparing to unpack .../libhtml-template-perl_2.95-2_all.deb ...
Unpacking libhtml-template-perl (2.95-2) ...######################..................................................]
Selecting previously unselected package mysql-server.#################..............................................]
Preparing to unpack .../mysql-server_5.7.16-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-server (5.7.16-0ubuntu0.16.04.1) ...####################............................................]
Processing triggers for ureadahead (0.100.0-19) ...#########################........................................]
Processing triggers for systemd (229-4ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up open-vm-tools (2:10.0.7-3227872-2ubuntu1) ...
udevadm trigger is not permitted while udev is unconfigured.
dpkg: error processing package open-vm-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up libevent-core-2.0-5:amd64 (2.0.21-stable-2) ...
Setting up libaio1:amd64 (0.3.110-2) ...########################################....................................]
Setting up mysql-client-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...######################................................]
Setting up mysql-client-5.7 (5.7.16-0ubuntu0.16.04.1) ...###############################............................]
Setting up mysql-server-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...##############################........................]
Setting up mysql-server-5.7 (5.7.16-0ubuntu0.16.04.1) ...#######################################....................]
invoke-rc.d: could not determine current runlevel#################################################..................]
 * Stopping MySQL database server mysqld                                                                         [ OK ]
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
invoke-rc.d: could not determine current runlevel
Setting up libhtml-template-perl (2.95-2) ...#######################################################................]
Setting up mysql-server (5.7.16-0ubuntu0.16.04.1) ...###################################################............]
Processing triggers for libc-bin (2.23-0ubuntu4) ...########################################################........]
Processing triggers for systemd (229-4ubuntu11) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
 open-vm-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@Ashish:~# sudo service mysql start
 * Starting MySQL database server mysqld                                                                                No directory, logging in with HOME=/
                                                                                                                 [ OK ]
  • Your Windows build number

  • Steps / All commands required to reproduce the error from a brand new installation

  • Strace of the failing command

  • Required packages and commands to install

See our contributing instructions for assistance.

@jrock2004
Copy link

Running build 14393, Just installed the same way as you and when from the command line I run mysql -u root -p it asks for password that I set and it works. So either this has something to do with the version of WSL you have or maybe you have something installed that is conflicting with it?

@sunilmut
Copy link
Member

sunilmut commented Dec 1, 2016

@ashishchandra I tried this on 14971 and it seems to be working fine. I am able to get to the mysq> prompt by MySQL -u root -p. Can you see if it is still reproducible on 14971?

@therobinkim
Copy link

therobinkim commented Apr 1, 2017

MySQL works for me on 15063 w/ Ubuntu 16.04!

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-server
# this skips all of the interactive menus, thereby
# creating a user `root` with empty password;
# you may not actually want to do this for
# your own setup, but I put it here for ease of duplication

mysql -u root # fails bc mysql service isn't running yet
sudo service mysql start
mysql -u root # works!

@ying-pbrc
Copy link

I am getting the same error trying to install MySQL on Bash on Windows 10 (15063.0) Ubuntu 16.04.1. have tried both w/ and w/o interactive menus.
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-server

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.0-5 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl
libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libtimedate-perl liburi-perl
mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx tinyca
The following NEW packages will be installed:
libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.0-5 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl
libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libtimedate-perl liburi-perl
mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 21 newly installed, 0 to remove and 23 not upgraded.
Need to get 0 B/19.0 MB of archives.
After this operation, 162 MB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 38184 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.7.17-0ubuntu0.16.04.2_all.deb ...
Unpacking mysql-common (5.7.17-0ubuntu0.16.04.2) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../libaio1_0.3.110-2_amd64.deb ...
Unpacking libaio1:amd64 (0.3.110-2) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../mysql-client-core-5.7_5.7.17-0ubuntu0.16.04.2_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../mysql-client-5.7_5.7.17-0ubuntu0.16.04.2_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../mysql-server-core-5.7_5.7.17-0ubuntu0.16.04.2_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Selecting previously unselected package libevent-core-2.0-5:amd64.
Preparing to unpack .../libevent-core-2.0-5_2.0.21-stable-2ubuntu0.16.04.1_amd64.deb ...
Unpacking libevent-core-2.0-5:amd64 (2.0.21-stable-2ubuntu0.16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu7) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-common (5.7.17-0ubuntu0.16.04.2) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 38353 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.17-0ubuntu0.16.04.2_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Selecting previously unselected package libhtml-tagset-perl.
Preparing to unpack .../libhtml-tagset-perl_3.20-2_all.deb ...
Unpacking libhtml-tagset-perl (3.20-2) ...
Selecting previously unselected package liburi-perl.
Preparing to unpack .../liburi-perl_1.71-1_all.deb ...
Unpacking liburi-perl (1.71-1) ...
Selecting previously unselected package libhtml-parser-perl.
Preparing to unpack .../libhtml-parser-perl_3.72-1_amd64.deb ...
Unpacking libhtml-parser-perl (3.72-1) ...
Selecting previously unselected package libcgi-pm-perl.
Preparing to unpack .../libcgi-pm-perl_4.26-1_all.deb ...
Unpacking libcgi-pm-perl (4.26-1) ...
Selecting previously unselected package libfcgi-perl.
Preparing to unpack .../libfcgi-perl_0.77-1build1_amd64.deb ...
Unpacking libfcgi-perl (0.77-1build1) ...
Selecting previously unselected package libcgi-fast-perl.
Preparing to unpack .../libcgi-fast-perl_1%3a2.10-1_all.deb ...
Unpacking libcgi-fast-perl (1:2.10-1) ...
Selecting previously unselected package libencode-locale-perl.
Preparing to unpack .../libencode-locale-perl_1.05-1_all.deb ...
Unpacking libencode-locale-perl (1.05-1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../libhtml-template-perl_2.95-2_all.deb ...
Unpacking libhtml-template-perl (2.95-2) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../libtimedate-perl_2.3000-2_all.deb ...
Unpacking libtimedate-perl (2.3000-2) ...
Selecting previously unselected package libhttp-date-perl.
Preparing to unpack .../libhttp-date-perl_6.02-1_all.deb ...
Unpacking libhttp-date-perl (6.02-1) ...
Selecting previously unselected package libio-html-perl.
Preparing to unpack .../libio-html-perl_1.001-1_all.deb ...
Unpacking libio-html-perl (1.001-1) ...
Selecting previously unselected package liblwp-mediatypes-perl.
Preparing to unpack .../liblwp-mediatypes-perl_6.02-1_all.deb ...
Unpacking liblwp-mediatypes-perl (6.02-1) ...
Selecting previously unselected package libhttp-message-perl.
Preparing to unpack .../libhttp-message-perl_6.11-1_all.deb ...
Unpacking libhttp-message-perl (6.11-1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.17-0ubuntu0.16.04.2_all.deb ...
Unpacking mysql-server (5.7.17-0ubuntu0.16.04.2) ...
Processing triggers for systemd (229-4ubuntu16) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libaio1:amd64 (0.3.110-2) ...
Setting up mysql-client-core-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Setting up mysql-client-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Setting up mysql-server-core-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Setting up libevent-core-2.0-5:amd64 (2.0.21-stable-2ubuntu0.16.04.1) ...
Setting up mysql-server-5.7 (5.7.17-0ubuntu0.16.04.2) ...
invoke-rc.d: could not determine current runlevel

  • Stopping MySQL database server mysqld [ OK ]
    update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
    Renaming removed key_buffer and myisam-recover options (if present)
    invoke-rc.d: could not determine current runlevel
    invoke-rc.d: could not determine current runlevel
  • Stopping MySQL database server mysqld [ OK ]
    dpkg: error processing package mysql-server-5.7 (--configure):
    subprocess installed post-installation script returned error exit status 1
    Setting up libhtml-tagset-perl (3.20-2) ...
    Setting up liburi-perl (1.71-1) ...
    Setting up libhtml-parser-perl (3.72-1) ...
    Setting up libcgi-pm-perl (4.26-1) ...
    Setting up libfcgi-perl (0.77-1build1) ...
    Setting up libcgi-fast-perl (1:2.10-1) ...
    Setting up libencode-locale-perl (1.05-1) ...
    Setting up libhtml-template-perl (2.95-2) ...
    Setting up libtimedate-perl (2.3000-2) ...
    Setting up libhttp-date-perl (6.02-1) ...
    Setting up libio-html-perl (1.001-1) ...
    Setting up liblwp-mediatypes-perl (6.02-1) ...
    Setting up libhttp-message-perl (6.11-1) ...
    dpkg: dependency problems prevent configuration of mysql-server:
    mysql-server depends on mysql-server-5.7; however:
    Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.23-0ubuntu7) ...
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for systemd (229-4ubuntu16) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

@andrey-borgoyakov
Copy link

andrey-borgoyakov commented Jul 20, 2017

Get same error when I get update for mysql-server packages ubuntu 16.04.2

mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) while con
necting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
dmesg: read kernel buffer failed: Function not implemented
No apport report written because the error message indicates its a f
ollowup error from a previous failure.
E: Sub-process /usr/bin/dpkg returned an error code (1)

@fjsuarez
Copy link

fjsuarez commented Aug 2, 2017

After updating Ubuntu from 14.02 to 16.02 via sudo do-release-upgrade, every time I install or update a package I get this at the end of the output:

Errors were encountered while processing:
 mysql-server-5.7

@valeryan
Copy link

valeryan commented Aug 5, 2017

To recover from this state you can run these commands (warning: this will remove mysql and any data associated with it, do a backup)

sudo apt-get remove --purge 'mysql*'
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-server

Sometime you just got to tear it all out and start over you know.

@ylefebvre
Copy link

@valeryan Thanks for the concise instructions. This got rid of the update errors.

@teamrehab
Copy link

sudo rm -rf /etc/mysql /var/lib/mysql was key.

@shyjuk
Copy link

shyjuk commented Aug 28, 2018

Check the file file which makes error.
Download the same file from ubuntu repo and install it with command dpkg --force-all

Ex: dpkg --force-all -i mysql-server-core-5.7_5.7.23-0ubuntu0.18.04.1_amd64.deb

@chx
Copy link

chx commented Sep 6, 2018

If apt errors out, manually restart mysql and temporarily edit /etc/init.d/mysql to add an exit 0 to the beginnign

@libre-x
Copy link

libre-x commented Nov 20, 2019

seems to work normally in wsl2, and had no issues in wsl 1 either.

@WordsofDefiance
Copy link

WordsofDefiance commented Apr 3, 2020

FWIW I had to completely remove mysql for it to start working again.

sudo rm -rf /var/lib/mysql/mysql
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-server

from here

I also had to restore the mysql databases manually as described here

@matthework
Copy link

If you can't install mysql on wsl, there is workaround here.
Install and run mysql on windows, then connect it from bash by using:

mysql -u root -p --host=127.0.0.1 --port=3306 --protocol=TCP

Don't use localhost instead, and port is 3306 on my pc.
I can't install mysql on wsl either, hope it can work on wsl2.

@sabl0r
Copy link

sabl0r commented May 14, 2020

I had mariadb sources added, which caused trouble and none of the solutions above worked for me.
After removing the mariadb sources, it worked like a charm.
Props go out to https://askubuntu.com/a/1134184

@therealkenc
Copy link
Collaborator

Strange one. From way up-top in the OP, mysql started and was fine from the get-go. The spurious error was from ureadahead evoking open-vm-tools.

@aCoder2013
Copy link

this repo works for me
https://github.com/DamionGans/ubuntu-wsl2-systemd-script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests