问题
Using adminer-4.7.2-mysql.php on my home laptop with Kubuntu 18 is there is a way to login to it without password entering? Or session time as long as possible ?
Thanks!
回答1:
Adminer doesn't allow connection without password for security reasons.
If you want to login without password because you're working in local environment you must use the login-password-less plugin.
1. Install adminer default core file
Download the adminer core file PHP:
wget https://github.com/vrana/adminer/releases/download/v4.7.5/adminer-4.7.5.php
Then rename it to adminer_core.php:
mv adminer-4.7.5.php adminer_core.php
Access to this adminer file from web browser and test login without password.
You can see the error message from Adminer by default:
2. Install plugins
To use plugins with Adminer you need to install the plugin autoloader file:
mkdir plugins
cd plugins
wget https://raw.githubusercontent.com/vrana/adminer/master/plugins/plugin.php
Then install the login password less plugin into plugins
directory:
wget https://raw.githubusercontent.com/vrana/adminer/master/plugins/login-password-less.php
3 Configure your Adminer password
Last step is to define a password that will not be use for MySQL connection but only for Adminer authentification:
nano adminer.php
In this file copy/paste the following code and replace YOUR_PASSWORD_HERE
by any password you want:
<?php
function adminer_object() {
include_once "./plugins/plugin.php";
include_once "./plugins/login-password-less.php";
return new AdminerPlugin(array(
// TODO: inline the result of password_hash() so that the password is not visible in source codes
new AdminerLoginPasswordLess(password_hash("YOUR_PASSWORD_HERE", PASSWORD_DEFAULT)),
));
}
include "./adminer_core.php";
4. That's it!
Now you can access to http://localhost/adminer.php and authenticate yourself with the previous password you have set in adminer.php
.
In resuming you have the following architecture:
└ localhost
├ adminer.php
├ adminer_core.php
└ plugins
├ login-without-password.php
├ plugin.php
Enjoy! ☺☼♪♫
来源:https://stackoverflow.com/questions/58009920/how-to-enter-adminer-without-password