Richard de Jonge's picture

I did the thing!

Either a) I've forgotten which credential pair works with Adminer b) i don't know what I'm doing.

Pretty frustrated at myself, 15 years in IT and I didn't log down the adminer password during setup, but did everything else. Now I'm trying to import a sql export into adminer (Mysql underneath right?) and can't log in.

Username: adminer password: blank

No dice, so it's got another password me thinks. Tried root too. I would think there's a way to get around this with console access.

The environment is; Proxmox8 > Debian12 CT > Turnkey Wordpress installed and host configured for public www hosting [bmsworld.nz] I am able to logon to the Debian12 CT via console just fine.

ANd ful disclosure - I'm a windows IT guy, Linux and linux hypervisors have been a homelab staple for the last 2 years and i've just been learning what I need to :) - but this one has me stumped. :(

Forum: 
Jeremy Davis's picture

The "adminer" MySQL/MariaDB user password can be reset via CLI a couple of ways. Note that for security, it should NEVER have no password. Hence why our firstboot script (aka inithook) requires a relatively complex password of at least 8 characters.

Before I go on, it's worth being aware that I used the term MySQL/MariaDB above as technically we provide MariaDB. It's a fork of MySQL, but remains (mostly) backwards compatible. Importing a MySQL DB into MariaDB should "just work" - but it may not always work going the other way. These days MariaDB is the default "MySQL" provided by most Linux distros. The default MariaDB executable is still 'mysql' (although 'mariadb' can also be used). The config can be found in the default MySQL place, i.e.: /etc/mysql. I try to remember to give that info to new users as often the terms MySQL and MariaDB are used interchangeably (including by me) when actually referring to MariaDB. So with that out of the way...

Probably the easiest way to achieve your ends is to use the first boot script (aka inithook) we provide - the same script that sets it in the first place.

You can run it interactively like this:

/usr/lib/inithooks/bin/mysqlconf.py

Unlike at firstboot, it will also ask for username, as well as password. Obviously the username in your case is "adminer".

Alternatively, quicker and easier, you can just run it non-interactively:

/usr/lib/inithooks/bin/mysqlconf.py --user=adminer --pass='NEW_PASSWORD'

Where (as is again likely obvious) NEW_PASSWORD is your new password.

The other method is using the default mysql CLI. FYI, this should work with any modern Linux distro running mariadb - or "actual" mysql. Assuming you are logged in to a terminal as root, starting an interactive CLI session is as simple as this:

mysql

Note that default mariadb authentication is via Linux socket - which only works with local CLI root access - hence why Adminer requires a separate user. That means that when logged into a terminal as the root Linux user, no password is required to log in as the root mysql user.

You should be greeted with a mariadb prompt:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is xxxx
Server version: 10.11.6-MariaDB-0+deb12u1 Debian 12

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Then run the SQL commands:

ALTER USER 'adminer'@'localhost' IDENTIFIED BY 'NEW_PASSWORD';
FLUSH PRIVILEGES;

Use 'exit' or 'quit' to get back to the Linux CLI.


And now for my ramble :)

Historically I was also a Windows guy (last versions used regularly were Win 7 & Server 2008r2). I mostly just used the GUI, but have become a huge Linux CLI fan. I still do a limited amount of (mostly break/fix) IT support on the side - for a Win only shop (10/11 these days). TBH after ~15 years of Linux, I find Win admin so painful, unintuitive and convoluted. The config is a mess - with some still only available via "Control Panel" but much now requires "Settings" and there is lots of cross over... Error messages are rarely ever directly very useful and logs are often cryptic. Info on errors/issues is often painful to find and I often find myself having to try multiple different commands to achieve my ends - even from the MS docs themselves (e.g. turns out that in this particular build number that doesn't work and you need to do something else). IMO the documentation - even on the MS site - is so scattered and lacking. I'm sure that as an experienced Win admin it makes more sense. But for me it feels like I need to jump through so many hoops to get something done that IMO should be easy. And everything takes way longer than it should.

Anyway, end rant. Now for my Linux fanboy spiel :)

IMO Linux admin is far superior, although only once you get your head around the different paradigm. Things are generally laid out more consistently; e.g. config in '/etc', app data in '/var/lib', logs in '/var/log' and so on. Things mostly "just work" and when they don't, usually give useful error messages. Obviously there are edge case exceptions, but mostly even if you don't understand what an error message means, you can just copy paste the exact error message into google and get a straight forward fix/workaround. And Linux docs and info are generally so much more accessible - not just online. From a CLI '--help' will usually give basic command info. Or for more detail (on most commands) 'man' (short for manual) is your friend!

See what I mean like this:

mysql --help

Then:

man mysql

In 'man', use up/down to scroll, '/SEARCH_TERM' to search for SEARCH_TERM, 'n' to jump to the next instance of the search term and 'q' to exit.

And another hint if you have issues with TurnKey, search online for "turnkey ..." first. If that doesn't turn up useful info then try "debian ..." (what TurnKey is based on). Debian info, docs and tutorials are almost always relevant to TurnKey. Ubuntu is also based on Debian, so info etc also often relevant. Although please be aware that Ubuntu is NOT binary compatible with Debian (or TurnKey) so don't ever add an Ubuntu apt repository to TurnKey - unless is explicitly says that it is compatible with Debian. For more info see the Dont Break Debian page.

And I could go on re all the other tools and useful but I should go do some other stuff.

Good luck with TurnKey. If you get stuck and/or have issues again, feel free to ask. Other feedback (good, bad and ugly) and/or suggestions on how it could be better is also always appreciated. Also if you hit an issue and find a solution yourself, bonus points if you open a new thread noting the issue and the solution your found. Even if it feels like something you should have known and/or seems obvious in retrospect, it all helps make things easier and more accessible for others. After all, that's the aim of TurnKey Linux, to make Linux more accessible to everyone.

Richard de Jonge's picture

:O I love a good reply (:

The "adminer" MySQL/MariaDB user password can be reset via CLI a couple of ways. Note that for security, it should NEVER have no password.

Oh I agree 100% - original password I set would have been well over 14 characters with symbols, capitols, lowercase and numbers - same with all my passwords, might be part of the reason I forgot it.

Before I go on, it's worth being aware that I used the term MySQL/MariaDB above as technically we provide MariaDB. It's a fork of MySQL, but remains (mostly) backwards compatible.

Thanks for the clarity on that. I wasn't aware there was forks of MySQL, but rather I considered MariaDB, MySQL or PostgreSQL etc as *individual products* - so that's quite helpful, one misunderstanding down!

I believe VirtualMin w/ WP installed is 'just'mysql, so from what I can tell;

Turnkey
MySQL version: 10.11.6-MariaDB-0+deb12u1 through PHP extension MySQLi

VirtualMin/WP
MySQL version 5.7.44-0ubuntu0.18.04.1+esm1

So I ended up running the mysqlconf.py script - so HANDY! and successfully logged into adminer (yay)

The struggle!

Jeremy Davis's picture

I'm glad that my waffle had some value. :)

Re MySQL vs MariaDB, the background of the MariaDB fork is that it occurred when Oracle bought out Sun (who owned MySQL). The MySQL founder, Michael “Monty” Widenius (who was working for Sun) left (along with a number of the other MySQL developers) and started MariaDB. AFAIK he left because Oracle have a reputation for not being particularly open source friendly, but perhaps there is more to it? I note that since Oracle's take over, many of the new and more advanced MySQL features are not in the free open source version; only in the paid, non open source version.

As a little trivia; MySQL was named after the founder's first daughter, My and MariaDB is named after his second daughter, Maria.

In my experience, the general CLI commands work exactly the same but the SQL specifically and other features are drifting more and more over time. So while there are still a lot of similarities, your initial understanding (i.e. separate products) not an unreasonable way to look at them these days. If you're interested, the MariaDB docs include good info about the compatibility between MariaDB and MySQL. There is also more detailed info between specific versions of MariaDB and MySQL if you ever finding yourself needing to migrate a MySQL DB.

Anyway, good luck with it all and hopefully see you about some other time.

Add new comment