1

I'm usually not using Ubuntu, but decided to give it a try today because it's the preferred distro for Windows Subsystem for Linux, that I wanted to try today to see if/how it could replace my VMWare machines on Windows 10.

So I'm using Ubuntu on WSL, although I don't think it makes a difference here.


Anyway, I installed the MySQL APT repo to get MySQL 8.0:

$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
$ sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb
$ sudo apt-get update
$ sudo apt-get install mysql-server

Now when I attempt to start the mysql service, I have no luck:

$ sudo service mysql start
mysql: unrecognized service

$ sudo service mysqld start
mysqld: unrecognized service

$ sudo service mysql-server start
mysql-server: unrecognized service

A quick look at init.d shows that there is no file for mysql:

$ ls -al /etc/init.d/mysql*
ls: cannot access '/etc/init.d/mysql*': No such file or directory

Note that I cannot use systemctl to start a service, as systemd is not available on WSL.

Now the interesting part: when I list the files inside the mysql-server package, it only contains files in /usr/share!

$ dpkg-query -L mysql-server
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/mysql-server
/usr/share/doc/mysql-server/LICENSE.gz
/usr/share/doc/mysql-server/README
/usr/share/doc/mysql-server/changelog.Debian.gz
/usr/share/doc/mysql-server/copyright
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/mysql-server

Why is the mysql-server package missing the actual server files in MySQL APT repo?

  • 1
    Try the command apt depends mysql-server to list the packages that mysql-server depends upon. The server files are in those packages. msql-server is a version-independent package with an easy-to-remember name that pulls in the appropriate version of the actual server package(s). – user535733 Jul 24 '19 at 12:52
  • Thank you, I can see that mysql-server depends on mysql-community-server, which in turn depends on mysql-community-server-core. The second one contains the service files, i.e. /lib/systemd/system/mysql.service, while the third one contains the actual mysqld binary. So it looks like these packages cannot work without systemd, can they? – Benjamin Jul 24 '19 at 14:50
  • Mysql should work without the .service file. I suspect that's a red herring: The service file merely tells systemd the correct path-and-binary to launch...but you already know that. Note that your original problem was that you were trying to use sysvinit (instead of systemd) to start mysql-server. Among the same files, you should discover the sysvinit init file -- copy it into /etc/init.d/ – user535733 Jul 24 '19 at 14:55
  • The problem is, I don't want to manually start mysqld, I want to get it to start on boot. I can't see a sysvinit file in the package contents, what/where should I be looking for? – Benjamin Jul 24 '19 at 15:18
  • see if the comment here helps -- github.com/Microsoft/WSL/issues/3631#issuecomment-465966498 – e-cloud Aug 29 '19 at 13:38
-2

see if the comment here helps -- https://github.com/Microsoft/WSL/issues/3631#issuecomment-465966498

here is my workable gist https://gist.github.com/e-cloud/34acbefe0597a02f9a081a01eff6dd24

sudo apt-get remove mysql-server mysql-client -y
sudo apt-get autoremove -y && sudo apt-get autoclean -y

wget –c https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb # select 5.7

sudo apt-get update
sudo apt policy mysql-server #(it will show 5.x is the default candidate)

sudo apt-get -y install mysql-server
# ensure your host windows have no mysql service running
sudo service mysql start
sudo service mysql stop


sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb # select 8.0
sudo apt-get update
sudo apt policy mysql-server #(it will show 8.x is the default candidate)

sudo apt-get -y install mysql-server
sudo sed -ie 's/\/usr\/share\/mysql\/mysql-helpers/\/usr\/share\/mysql-8.0\/mysql-helpers/' /etc/init.d/mysql
sudo service mysql start
| improve this answer | |
  • 1
    Your gist doesn't explain why this does it, and because comments and links can die at any time the part about "see the comment here to see if it helps" is a link-only answer portion. That part is frowned upon because of the nature of this site. (Please also don't repost your post if it's already been deleted, it just adds noise and doesn't help much, especially since 'random gist solution' without explanation isn't very useful. – Thomas Ward Aug 29 '19 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.