planteg
Posts: 13
Joined: Tue Apr 26, 2016 10:04 pm

MySQL, interactive configuration not executed after installation

Sun May 05, 2019 11:36 pm

Hi,

I just installed the latest Raspbian from Noobs 3.0.1 (April 2019). I ran

Code: Select all

sudo apt-get install mysql-server
That resulted in strange things:

This is what I now have:

Code: Select all

pi@joomla3:~ $ dpkg -l| grep mysql
ii  default-mysql-server                  1.0.2                                             all          MySQL database server binaries and system database setup (metapackage)
ii  libdbd-mysql-perl                     4.041-2                                           armhf        Perl5 database interface to the MariaDB/MySQL database
ii  mysql-common                          5.8+1.0.2                                         all          MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-server                          5.5.9999+default                                  armhf        MySQL database server binaries and system database setup [transitional]
and

Code: Select all

pi@joomla3:~ $ dpkg -l| grep mariaii  libmariadbclient18:armhf              10.1.38-0+deb9u1                                  armhf        MariaDB database client library
ii  mariadb-client-10.1                   10.1.38-0+deb9u1                                  armhf        MariaDB database client binaries
ii  mariadb-client-core-10.1              10.1.38-0+deb9u1                                  armhf        MariaDB database core client binaries
ii  mariadb-common                        10.1.38-0+deb9u1                                  all          MariaDB common metapackage
ii  mariadb-server-10.1                   10.1.38-0+deb9u1                                  armhf        MariaDB database server binaries
ii  mariadb-server-core-10.1              10.1.38-0+deb9u1                                  armhf        MariaDB database core server files
First question: how come I have both MySQL and mariadb installed ?

I also noted that during MySQL installation the configuration was not called (asking for the root password for example). I tried

Code: Select all

sudo dpkg-reconfigure mysql-server
and after a few seconds the prompt came back with no message.

My second question: what's going out exactly ? I don't wand bot MySQL and mariadb, only MySQL. Is mariadb installed by default with Raspbian ? And how come I can't call the reconfiguration on MYSQL ?

Thanks

Gilles Plante

fbe
Posts: 645
Joined: Thu Aug 17, 2017 9:08 pm

Re: MySQL, interactive configuration not executed after installation

Mon May 06, 2019 7:16 pm

You have installed only MariaDB. mysql-server and default-mysql-server install nothing except for dependencies.

Code: Select all

pi@headless-pi:~ $ apt show mysql-server
Package: mysql-server
Version: 5.5.9999+default
Priority: optional
Section: misc
Source: mysql-transitional
Maintainer: Ondřej Surý <ondrej@debian.org>
Installed-Size: 8,192 B
Depends: default-mysql-server
Download-Size: 1,706 B
APT-Manual-Installed: yes
APT-Sources: http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages
Description: MySQL database server binaries and system database setup [transitional]
 This is a transitional MySQL database that depends on default MySQL
 database metapackage.  It can be safely removed.

pi@headless-pi:~ $ dpkg -L mysql-server
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/mysql-server
/usr/share/doc/mysql-server/changelog.gz
/usr/share/doc/mysql-server/copyright
pi@headless-pi:~ $ apt show default-mysql-server
Package: default-mysql-server
Version: 1.0.2
Priority: optional
Section: database
Source: mysql-defaults
Maintainer: Debian MySQL Maintainers <pkg-mysql-maint@lists.alioth.debian.org>
Installed-Size: 9,216 B
Depends: mariadb-server-10.1
Download-Size: 3,048 B
APT-Manual-Installed: no
APT-Sources: http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages
Description: MySQL database server binaries and system database setup (metapackage)
 MySQL is a fast, stable and true multi-user, multi-threaded SQL database
 server. SQL (Structured Query Language) is the most popular database query
 language in the world. The main goals of MySQL are speed, robustness and
 ease of use.
 .
 This package depends on the default implementation of all the infrastructure
 needed to setup system databases.

pi@headless-pi:~ $ dpkg -L default-mysql-server
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/default-mysql-server
/usr/share/doc/default-mysql-server/changelog.gz
/usr/share/doc/default-mysql-server/copyright
pi@headless-pi:~ $
There is no password set for root@localhost.

Code: Select all

zless /usr/share/doc/mariadb-server-10.1/README.Debian.gz
...
* ROOT USER AUTHENTICATION VIA UNIX SOCKET
==========================================
On new installs no root password is set and no debian-sys-maint user is
created anymore. Instead the MariaDB root account is set to be authenticated
using the unix socket, e.g. any mysqld invocation by root or via sudo will
let the user see the mysqld prompt.

You may never ever delete the mysql user "root". Although it has no password
is set, the unix_auth plugin ensure that it can only be run locally as the root
user.

The credentials in /etc/mysql/debian.cnf specify the user which is used by the
init scripts to stop the server and perform logrotation. This used to be the
debian-sys-maint user which is no longer used as root can run directly.

If you have start/stop problems make sure that the /etc/mysql/debian.cnf file
specifies the root user and no password.

* MARIADB IS SECURE BY DEFAULT
==============================

MariaDB in Debian is secure by default, because:

- It only listens to the localhost socket and cannot be accessed remotely unless
the sysadmin changes the configurationin /etc/mysql to allow so.
- There is no debian-sys-maint with password in /etc/mysql/debian.cnf anymore.
- There is no root account with password anymore. The system admin needs to
create one themselves if they need it. With no password, all issues related
to password management and password leaking are gone. Sysadmins can access
the database without a password simply by running 'sudo mysql' thanks to
socket based authentication, which detects the system root user and allows
them to use the mysqld console as the mysql root user. For details see
https://www.slideshare.net/ottokekalain ... ening-tips
- There is no test database nor test accounts in the out-of-the-box Debian
installation.

Therefore there is also no need to run the 'mysql_secure_installation'. In fact
that script will try to do things that are already prevented, and might fail.
...
If you need an account with native password authentication and privileges like root@localhost:

Code: Select all

pi@headless-pi:~ $ sudo mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.38-MariaDB-0+deb9u1 Raspbian 9.0

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> grant all privileges on *.* to 'admin'@'localhost' identified by 'secret' with grant option;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit;
Bye
pi@headless-pi:~ $ mysql -uadmin -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.38-MariaDB-0+deb9u1 Raspbian 9.0

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Return to “Networking and servers”