[Maria-discuss] setting db root passwd failed now reinstall is failing
Hi there, I am doing a poor job installing mariadb. I need to install mariadb on a new ubunutu server. I attempted to set the root password and was having difficulties getting mariadb in a usable state after that. So I attempted a purge and reinstall of mariadb (same version). Now I cant start the daemon and I dont have a /var/lib/mysql directory anymore. What can I do? $ sudo mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Enter current password for root (enter for none): ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Enter current password for root (enter for none): ^^^ I dont know what this password is? Typing 'enter' doesnt work ~$ ls -l /var/lib/mysql* ls: cannot open directory '/var/lib/mysql-files': Permission denied ls: cannot open directory '/var/lib/mysql-keyring': Permission denied $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS" ~$ sudo apt list --installed | grep mariadb WARNING: apt does not have a stable CLI interface. Use with caution in scripts. mariadb-client-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [installed,automatic] mariadb-client-core-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [installed,automatic] mariadb-common/focal,now 1:10.3.22-1ubuntu1 all [installed,automatic] mariadb-server-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [installed,automatic] mariadb-server-core-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [installed,automatic] mariadb-server/focal,now 1:10.3.22-1ubuntu1 all [installed] noah@nuc2:~$ sudo systemctl restart mariadb Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details. noah@nuc2:~$ systemctl status mariadb.service ● mariadb.service - MariaDB 10.3.22 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Fri 2020-06-19 19:21:52 UTC; 4s ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Process: 548722 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS) Process: 548733 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Process: 548736 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=> Process: 548785 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE) Main PID: 548785 (code=exited, status=1/FAILURE) Jun 19 19:21:51 nuc2 systemd[1]: Starting MariaDB 10.3.22 database server... Jun 19 19:21:52 nuc2 mysqld[548785]: 2020-06-19 19:21:52 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-1ubuntu1) starting as process 548785 ... Jun 19 19:21:52 nuc2 mysqld[548785]: 2020-06-19 19:21:52 0 [Warning] Can't create test file /var/lib/mysql/nuc2.lower-test Jun 19 19:21:52 nuc2 mysqld[548785]: [97B blob data] Jun 19 19:21:52 nuc2 mysqld[548785]: 2020-06-19 19:21:52 0 [ERROR] Aborting Jun 19 19:21:52 nuc2 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE Jun 19 19:21:52 nuc2 systemd[1]: mariadb.service: Failed with result 'exit-code'. Jun 19 19:21:52 nuc2 systemd[1]: Failed to start MariaDB 10.3.22 database server. Cheers, Noah
On Fri, 19 Jun 2020 12:27:02 -0700 ubuntu@enabled.com wrote:
Hi there,
I am doing a poor job installing mariadb.
Yes.
I need to install mariadb on a new ubunutu server.
Yes.
I attempted to set the root password and was having difficulties getting mariadb in a usable state after that.
Don't do that. The mysql root user is only accessible by the unix root user and therefore its secure as your root user. It needs to stay like this so that upgrades work. Create a new admin user like this answer: https://stackoverflow.com/questions/41846000/mariadb-password-and-unix-socke...
So I attempted a purge and reinstall of mariadb (same version).
That's the wrong way to solve a problem.
Now I cant start the daemon and I dont have a /var/lib/mysql directory anymore. What can I do?
create it: sudo -u mysql mysql_install_db
$ sudo mysql_secure_installation
not required.
noah@nuc2:~$ sudo systemctl restart mariadb
then do this ^ again
So far so good. It's working. Thanks, Daniel. On 6/19/20 4:03 PM, Daniel Black wrote:
On Fri, 19 Jun 2020 12:27:02 -0700 ubuntu@enabled.com wrote:
Hi there,
I am doing a poor job installing mariadb.
Yes.
I need to install mariadb on a new ubunutu server.
Yes.
I attempted to set the root password and was having difficulties getting mariadb in a usable state after that.
Don't do that. The mysql root user is only accessible by the unix root user and therefore its secure as your root user. It needs to stay like this so that upgrades work.
Create a new admin user like this answer:
https://stackoverflow.com/questions/41846000/mariadb-password-and-unix-socke...
So I attempted a purge and reinstall of mariadb (same version).
That's the wrong way to solve a problem.
Now I cant start the daemon and I dont have a /var/lib/mysql directory anymore. What can I do?
create it:
sudo -u mysql mysql_install_db
$ sudo mysql_secure_installation
not required.
noah@nuc2:~$ sudo systemctl restart mariadb
then do this ^ again
participants (2)
-
Daniel Black
-
ubuntu@enabled.com