Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manually set phpMyAdmin login cookie validity time

Tags:

phpmyadmin

In phpMyAdmin I set the 'login cookie validity' to 1sec. As one can imagine, it now throws me out after 1 second of logging in. I can't change it back in phpMyAdmin fast enough so I need a manual alternative.

I don't want to reinstall phpMyAdmin as I will loose all of my databases. I also can't stay logged in long enough to export them. Is there a way to do this manually?

I've tried setting the session.gc_maxlifetime to 86400 in my php.ini file but it did nothing.

like image 626
proPhet Avatar asked Feb 02 '14 11:02

proPhet


3 Answers

In your config.inc.php file set both the login cookie validity and the session max lifetime so that you won't get the following warning:

Your PHP parameter session.gc_maxlifetime is lower than cookie validity configured in phpMyAdmin, because of this, your login might expire sooner than configured in phpMyAdmin.

So put this in your config.inc.php file and you'll be fine (change the time accordingly to your neeeds):

$sessionValidity = 3600 * 24 * 365; // one year

$cfg['LoginCookieValidity'] = $sessionValidity;
ini_set('session.gc_maxlifetime', $sessionValidity);

Check also in your database, it may be worth temporarily disabling it so that the settings there do not override the ones in the config.inc.php file.

like image 108
Francesco Casula Avatar answered Oct 29 '22 16:10

Francesco Casula


in the config.inc.php file, which should be located in your phpadmin root folder, add this setting:

$cfg['LoginCookieValidity'] = 14400;

14400 is the number of seconds before timeout; 14400 is 4 hours. Of course, you can use whatever interval you like.

like image 32
Asaf Magen Avatar answered Oct 29 '22 15:10

Asaf Magen


Based on your question, it sounds like you changed it through the Settings tab within phpMyAdmin. If you have the phpMyAdmin Configuration Storage configured, that setting is stored there, if not it's just stored in your browser session so accessing from another browser or expiring that session/removing the cookie should do it. If it's in the phpMyAdmin Configuration Storage database you've got two means to get around it.

  1. Disable the database. Edit config.inc.php and temporary comment out the line about $cfg['Servers'][$i]['userconfig']. Log in, open the phpMyAdmin database (by default probably called phpmyadmin) and edit the userconfig table (by default pma__userconfig). You can click to edit the corresponding value in the config_data column or just delete that row entirely to reset all your preferences.
  2. Log in from the command line (or any other MySQL administrative tool), open the phpMyAdmin database (by default probably called phpmyadmin) and edit the userconfig table (by default pma__userconfig). You can edit the corresponding value in the config_data column or just delete that row entirely to reset all your preferences. This will require a bit of SQL ability (not a whole lot), so probably the first method is easier unless you're comfortable with the MySQL command line interface.

The standard disclaimers about backing up first apply, of course.

like image 2
Isaac Bennetch Avatar answered Oct 29 '22 17:10

Isaac Bennetch