KDE's akonadi sets mysql root password to a non-empty value and I can't find it

3

I recently set up an openSUSE 12.2 vm and I chose KDE as the desktop. KDE (4.3) happens to come with an application called 'akonadi' which happens to use mysql. The result is that mysql seems to come pre-configured with a non-empty root password. The reason I set up an openSUSE vm is that I wrote an install script for some software and I want it to work on openSUSE. On fedora/rh, I can anticipate mysql being installed with an empty root password and then have the user run mysql_secure_installation. On debian/ubuntu, debconf has the user enter the mysql root password during installation of the mysql server. But, I've probably always chosen gnome before, so maybe this would not work if I chose kde.

Anyhow,my question boils down to: Really? Does kde really set a non-empty root password when configuring mysql for akonadi? and Really? Is it really harder than googling to figure out what it is set to? And, finally, (head hung low) can anyone tell me how to find it out?

Thanks!

Jason

Jason

Posted 2012-11-24T21:27:44.083

Reputation: 131

Answers

0

You can force MySQL/MariaDB to set its root password by starting the process as root (without networking) and logging in passwordlessly, then executing an ALTER USER to change the root password. Most of this I read here. The procedure is slightly different on MariaDB but should be syntactically equivalent.

I just had to do this on MySQL 5.7.18 Community (on Fedora 24), so it's known to work on at least one system.

  1. Stop any mysqld instances by either sending them SIGTERM (e.g. through htop) or shutting them down from your service manager (sudo systemctl stop mysqld.service)
  2. Start MySQL as the system root user and fork it into the background with:

    $ sudo mysqld --skip-grant-tables --skip-networking --user=root &
    
  3. Now that MySQL is running (and horribly vulnerable, hence the --skip-networking argument), log into it:

    $ sudo mysql -u root
    
  4. Load MySQL's user table so we can edit it:

    mysql> FLUSH PRIVILEGES;
    
  5. Set a new password for MySQL's root user. Make sure you correctly escape any funny characters.

    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'correct \'horse\' battery staple';
    mysql> exit;
    
  6. Send MySQL another SIGTERM:

    $ sudo kill `cat /var/run/mysqld/mysqld.pid`
    
  7. Start MySQL normally again:

    $ sudo systemctl start mysqld.service
    
  8. Verify that you can now log in with the MySQL root user's password:

    $ mysql -u root -p
    

You will be prompted for the password you entered, and voilĂ !

Tullo_x86

Posted 2012-11-24T21:27:44.083

Reputation: 140