2

I've tried to follow the official guidance on installing MySQL on a fresh Debian install.

So I went to https://dev.mysql.com/downloads/repo/apt/, downloaded mysql-apt-config_0.8.13-1_all.deb,

Run through the installer options with

sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb

...which seems to work (albeit with a warning):

(Reading database ... 32947 files and directories currently installed.)
Preparing to unpack mysql-apt-config_0.8.13-1_all.deb …
Unpacking mysql-apt-config (0.8.13-1) over (0.8.13-1) …
Setting up mysql-apt-config (0.8.13-1) …
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config)
OK

I do my

sudo apt update

Which again, seems to give sensible output:

Get:1 http://security.debian.org/debian-security buster/updates InRelease [39.1 kB]
Hit:2 http://deb.debian.org/debian buster InRelease
Get:3 http://deb.debian.org/debian buster-updates InRelease [49.3 kB]
Hit:4 http://repo.mysql.com/apt/debian buster InRelease
Hit:5 https://packages.microsoft.com/debian/10/prod buster InRelease
Fetched 88.4 kB in 1s (85.1 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

Things start to go wrong when I get to step 2, as running

sudo apt-get install mysql-server

Fails with output:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mysql-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'mysql-server' has no installation candidate

So what am I doing wrong that is stopping this from working?

I've checked /etc/apt/sources.list.d/mysql.list, and that looks sensible:

### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out entries below, but any other modifications may be lost.
# Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications.
deb http://repo.mysql.com/apt/debian/ buster mysql-apt-config
deb http://repo.mysql.com/apt/debian/ buster mysql-8.0
deb http://repo.mysql.com/apt/debian/ buster mysql-tools
#deb http://repo.mysql.com/apt/debian/ buster mysql-tools-preview
deb-src http://repo.mysql.com/apt/debian/ buster mysql-8.0

The output from apt-cache policy mysql-server is

mysql-server:
  Installed: (none)
  Candidate: (none)
  Version table:
13
  • 1
    Please can you add the output of cat /etc/apt/sources.list.d/mysql.list or the appropriate equivalent. (I'm interested in the deb configuration, so grep -r mysql /etc/apt/sources* would work, too.)
    – roaima
    Aug 20 '19 at 20:22
  • @roaima it looks sane to me, but have added to the question :) Aug 21 '19 at 19:27
  • 1
    @Jona that looks a little odd to me, as I'd expect something to be showing as a candidate and something in the version table :/ Aug 21 '19 at 20:01
  • 1
    Sorry, I meant dpkg --print-architecture ?
    – Jona
    Aug 21 '19 at 20:29
  • 1
    See, that gives i386, which you'd think would count as supported Aug 21 '19 at 20:34
5

Their repository is broken for your request.

Compare this file (0k):

http://repo.mysql.com/apt/debian/dists/buster/mysql-8.0/binary-i386/Packages

to this one (26k) :

http://repo.mysql.com/apt/debian/dists/buster/mysql-8.0/binary-amd64/Packages

or this one (3k):

http://repo.mysql.com/apt/debian/dists/buster/mysql-tools/binary-i386/Packages

i.e. : The first 'Packages' file is empty; and it is not normal : https://wiki.debian.org/DebianRepository/Format#A.22Packages.22_Indices

1
  • This should have been chosen as the correct answer. As opposed to the other answers, it explains why the installation failed for the OP, instead of trying to persuade him to install MariaDB (which he clearly does not want to do).
    – Binarus
    May 31 '20 at 9:24
4

To install the Debian provided packages, remove the repository that was installed from dev.mysql.com, and then this command should work:

apt install mariadb-server mariadb-client

MariaDB is the new name for the non-Oracle MySQL.

If you prefer to use the Oracle MySQL, then you just need to get the proper package name for the version you wish to install. Check the output of apt search mysql-server to see what is available (in their packaging, they seem to put the version as part of the name).

5
  • 4
    MariaDB is a fork of MySQL, which is still going strong. Your post doesn't explain how to install MySQL.
    – roaima
    Aug 20 '19 at 19:29
  • The poster was half-way to installing Oracle MySQL already, they just did not have the proper package name. I do not know what version they want to use, so could not recommend a name but instead gave a command where they could see the available versions. Aug 20 '19 at 19:57
  • repo.mysql.com/apt/debian/dists/buster/mysql-8.0/binary-amd64/… implies the package name is correct, but apt isn't seeing it for me :/ Aug 20 '19 at 20:05
  • (or dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/…, if you prefer) Aug 20 '19 at 20:16
  • 1
    The OP clearly wants to install the original MySQL instead of the MariaDB replacement. But the command shown above will install MariaDB and thus does the opposite of what the OP wanted. Plus, apt search mysql-server will find two packages: default-mysql-server and default-mysql-server-core. If you install them, you get MariaDB instead of MySQL.
    – Binarus
    May 31 '20 at 9:28
4

this worked for me on buster:

apt-get install default-mysql-server
3
  • Funny thing; when I ran this, apt tried to install a bunch of mariadb packages including mariadb-client-10.3 and mariadb-server-10.3. I wonder if this installs mariadb instead, but in some sort of mysql-compatible mode. Mar 26 '20 at 14:03
  • I believe that this answer is plain wrong. The OP clearly wants to install the original MySQL instead of the MariaDB replacement. But the command shown above will install MariaDB and thus does the opposite of what the OP wanted.
    – Binarus
    May 31 '20 at 9:19
  • This worked for me using debian in wsl 2 Sep 10 at 3:07

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