While I NEVER experienced any problems with this on several Debian 8 machines and even Windows, I now simply can't manage to get a working installation of MariaDB/MySQL on my fresh installation of Debian 9 Stretch.

In my first installation I couldn't get access to the root account of mysql. Since then I tried a lot.

My Password Reset Attempts included among others the following:

https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html https://www.howtoforge.com/setting-changing-resetting-mysql-root-passwords https://help.ubuntu.com/community/MysqlPasswordReset https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password mysql how to fix Access denied for user 'root'@'localhost'

As that all didn't work I then gave up and started several attempts to entirely reinstall first just the mariadb/mysql packages, then all LaMp related packages.

I therefore first purged all packages

sudo apt-get remove --purge *mariadb* *mysql* *php* apache2 phpmyadmin
sudo apt-get autoremove
sudo apt-get clean

(this is the most drastic attempt i have chosen)

And afterwards I followed those installation tutorials

http://www.pcsystembetreuer.de/cms-online-designer/lamp-debian-9-stretch.html http://www.itzgeek.com/how-tos/linux/debian/how-to-install-lamp-server-on-debian-9-stretch.html https://linuxconfig.org/how-to-install-a-lamp-server-on-debian-9-stretch-linux

Again, none of the above worked for me. To be more specific: I can't log into the root user of mariadb if i am not the root user of my system. Though, in case of the latter I could even log in if the password i provide would be completely wrong. I've set up the password with e.g. mysql_secure_installation as the root user. If I try to run this command as my normal user, I get told that I did not provide the correct old password to change it. Though there is no old password as I've never set any password and even just did a clean install of mariadb.

As much as I try and search through similar problems I can't manage to find a way that works for me and am right now close to insanity (following the definition that sanity is when you try the same thing over and over again expecting different results.).

I don't need any "safe solutions" as I have no DBs that could be deleted yet. Perfect for me would be a CLEAN installation that gets rid of any - apparently existing - old configuration files storing a mysterious password that I don't know. Or, I just do something entirely wrong. Just don't know what.

  • I have run into this exact same problem, fresh install of mariadb and having to crack the root password in order to set it to what I want. I don't recall how I fixed this issue, unfortunately. One thing you could do is make sure EVERY package is removed by an apt-get purge mariadb. When installed, do 'dpkg -L mariadb | tee mariadbpkgs.txt' to list all packages and store in a file. Do 'apt-get purge mariadb'. Finally make sure all packages are removed with 'cat mariadbpkgs.txt | sudo xargs -I X rm -f X' – Kyle H Jul 29 '17 at 13:32
up vote 4 down vote accepted

Try to remove the plugin configuration like this:

$ sudo mysql -u root

mysql> use mysql;
mysql> update user set plugin='' where User='root';
mysql> flush privileges;

Solution from: https://serverfault.com/questions/795290/admin-password-of-mariadb-doesnt-seem-to-work

  • That worked, combined with Password resets. – weidler Aug 21 '17 at 11:07
  • Thank you very much! I've lost some good hours searching for a solution. – blackwolf Sep 29 '17 at 13:55

At least under Jessie and Wheezy, the root password for a fresh MariaDB install is blank. mysql -u root -p then hit Enter.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.