2

A bit of background information. I have rasbian installed on my raspberry pi 3 and i'm trying to set up mysql however it seems there is a password already set. I tried purging mariadb and mysql but I am never prompted to create the password after fresh install.

I tried resetting the password using this and everything worked but when i got to starting mysql up again, it timed out:

    pi@raspberrypi:~ $ sudo /etc/init.d/mysql start
    [....] Starting mysql (via systemctl): mysql.serviceJob for 
    mariadb.service failed because a timeout was exceeded.
    See "systemctl status mariadb.service" and "journalctl -xe" for details.
     failed!

journalctl -xe:

    -- Defined-By: systemd
    -- Support: https://www.debian.org/support
    -- 
    -- Unit mariadb.service has failed.
    -- 
    -- The result is failed.
    Sep 05 12:22:26 raspberrypi systemd[1]: mariadb.service: Unit entered 
    failed sta
    Sep 05 12:22:26 raspberrypi systemd[1]: mariadb.service: Failed with 
    result 'tim
    Sep 05 12:22:26 raspberrypi sudo[1612]: pam_unix(sudo:session): session 
    closed f
    Sep 05 12:23:55 raspberrypi systemd[1]: Starting Cleanup of Temporary 
    Directorie
    -- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
    -- Defined-By: systemd
    -- Support: https://www.debian.org/support
    -- 
    -- Unit systemd-tmpfiles-clean.service has begun starting up.
    Sep 05 12:23:55 raspberrypi systemd[1]: Started Cleanup of Temporary 
    Directories
    -- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
    -- Defined-By: systemd
    -- Support: https://www.debian.org/support
    -- 
    -- Unit systemd-tmpfiles-clean.service has finished starting up.
    -- 
    -- The start-up result is done.
    lines 1644-1666/1666 (END)
    -- Defined-By: systemd
    -- Support: https://www.debian.org/support
    -- 
    -- Unit mariadb.service has failed.
    -- 
    -- The result is failed.
    Sep 05 12:22:26 raspberrypi systemd[1]: mariadb.service: Unit entered 
    failed state.
    Sep 05 12:22:26 raspberrypi systemd[1]: mariadb.service: Failed with 
    result 'timeout'.
    Sep 05 12:22:26 raspberrypi sudo[1612]: pam_unix(sudo:session): session 
    closed 
    for user root
    Sep 05 12:23:55 raspberrypi systemd[1]: Starting Cleanup of Temporary 
    Directories...
    -- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
    -- Defined-By: systemd
    -- Support: https://www.debian.org/support
    -- 
    -- Unit systemd-tmpfiles-clean.service has begun starting up.
    Sep 05 12:23:55 raspberrypi systemd[1]: Started Cleanup of Temporary 
    Directories.
    -- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
    -- Defined-By: systemd
    -- Support: https://www.debian.org/support
    -- 
    -- Unit systemd-tmpfiles-clean.service has finished starting up.
    -- 
    -- The start-up result is done.
    lines 1644-1666/1666 (END)

So my question is.. What is this journalctl -xe file saying. And also is there a default mysql root password on the Rpi3 with raspbian installed? I tried no password, 'root', 'pi', 'raspberry', 'raspberrypi' and the system password to no avail.

0

Run sudo mysqld_safe that process will replay MySQL/MariaDB logs, repair tables where possible then start the server normally.

If that fails consider recovering /var/lib/mysql from the last fire security backup.

-1

If you haven't any real data in your database then clear all in /var/lib/mysql.

sudo rm -rf /var/lib/mysql

After that try again to run command sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql to initialize database directory.

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER!
To do so, start the server, then issue the following commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h raspberrypi password 'new-password'

Alternatively you can run:
'/usr/bin/mysql_secure_installation'

which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers.

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.