I just installed MariaDB on an Ubuntu 17.04 server using
sudo apt install mariadb-server, and am just not able to log in.
~/.my.cnf does not exist. An empty passwort using
mysql -u root -p did not work.
So first, I've tried https://www.liberiangeek.net/2014/10/reset-root-password-mariadb-centos-7/, so I started mysql using
sudo mysqld_safe --skip-grant-tables --skip-networking &. Afterwards, I looked at
SELECT Password FROM mysql.user, which was empty (which seems strange for me, cause I could not log in with root and empty password). Afterwards, I've run
UPDATE mysql.user SET password=PASSWORD("root") WHERE user='root'; flush privileges;
in the console to change the password. While the password was set to
*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B, which seems correct, login just was not possible.
I afterwards tried to get into mysql by using sudo mysql -u root like described in an answer here
https://askubuntu.com/questions/489098/unable-to-reset-root-password-of-mysql, but there still the password is
*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B, so it does not seem like the password is the main issue.
Nevertheless, I can not log in. The service seems to be set up right:
● mariadb.service - MariaDB database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2017-05-08 17:38:44 CEST; 13min ago Process: 10397 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Process: 10394 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS) Process: 10276 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exit Process: 10272 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Process: 10270 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS) Main PID: 10366 (mysqld) Status: "Taking your SQL requests now..." Tasks: 27 (limit: 4915) Memory: 105.6M CPU: 745ms CGroup: /system.slice/mariadb.service └─10366 /usr/sbin/mysqld
and the process is also running on the right port
sudo netstat -taupen | grep 10366 tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 125 64559 10366/mysqld
but I can not login using
mysql -u root -p -P 3306 (and without the port information).
Has somebody an hint what could be wrong?