PHPMyAdmin: No activity within 1800 seconds; please log in again error - mysql

I have logged into phpmyadmin and have about 15 tables. I click on the one table and the data structure page loads up. I click on another and it works fine as well. However, when clicking on a certain table, it logs me out of phpmyadmin and I get this error message:
No activity within 1800 seconds; please log in again
I logged back in again and every time I click the specific table, it's giving me the error message. No other tables are having this trouble.
Any reasons for the cause of this and how to fix.
Thanks

Hi I also got the same Issue. I solved it by adding below line to my config.inc.php i.e by extending my time limit from 1800 seconds to 86400 seconds
$cfg['LoginCookieValidity'] = 86400;
For more details Please Refer the below link and follow the instructions over there.Thankyou!
http://firstcode.info/php-no-activity-within-1800-seconds-error/

For starters, this happened to me when I clicked "reset" in the settings panel of PHPMyAdmin and then clicked "apply" while on the features tab, which basically set "Login cookie validity" to empty string.
Played around plenty with config files in /var/lib/phpmyadmin/, /usr/share/phpmyadmin/, and /etc/phpmyadmin/ but no changes to login cookie validity had any effect.
So I figured PHPMyAdmin must have saved this dreaded configuration in a database. So I did the following:
mysql -u root -p
Enter password:
mysql> USE phpmyadmin
Database changed
SHOW TABLES;
+------------------------+
| Tables_in_phpmyadmin |
+------------------------+
| pma__bookmark |
| pma__central_columns |
| pma__column_info |
| pma__designer_settings |
| pma__export_templates |
| pma__favorite |
| pma__history |
| pma__navigationhiding |
| pma__pdf_pages |
| pma__recent |
| pma__relation |
| pma__savedsearches |
| pma__table_coords |
| pma__table_info |
| pma__table_uiprefs |
| pma__tracking |
| pma__userconfig |
| pma__usergroups |
| pma__users |
+------------------------+
19 rows in set (0.00 sec)
SELECT * FROM pma__userconfig
+---------------+---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| username | timevalue | config_data |
+---------------+---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| root | 2020-10-14 10:02:23 | {"LoginCookieValidity":"","LimitChars":500,"SQLQuery\/Explain":false,"SQLQuery\/ShowAsPHP":false,"MaxTableList":"","Server\/hide_db":"","collation_connection":"utf8mb4_unicode_ci"} |
+---------------+---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Sure enough, this is the bugger the config files weren't modifying. So I ran:
DELETE FROM pma__userconfig WHERE username='root'
Query OK, 1 row affected (0.00 sec)
FLUSH TABLES pma__userconfig
Then I restarted Apache for good measure:
sudo service apache2 restart
And voilĂ , all in the world was right again.

Related

How to import data from .sql file in mysql?

I have a 2.6GB file which I need to import and I used the command
sudo mysql -u root -p <dbname> > ~/<filename>.sql
I created a database from phpmyadmin and ran the above command.
It has been running for 30 minutes and when I run SHOW PROCESSLIST; on a separate window I get this
mysql> SHOW PROCESSLIST;
+-----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+-----------+------+---------+------+-------+------------------+
| 149 | root | localhost | test | Sleep | 1716 | | NULL |
| 155 | root | localhost | NULL | Query | 0 | init | SHOW PROCESSLIST |
+-----+------+-----------+------+---------+------+-------+------------------+
2 rows in set (0.00 sec)
What is happening and why is it gone to sleep? How do I solve this?
It turns out that mysql server in preferences keeps shutting down whenever I start it. How do I solve this?

How to kill a thread in PHPmyadmin

I have a thread showing in PHPmyadmin under processes. However, when I click kill, I get the error:
phpMyAdmin was unable to kill thread 148. It probably has already been closed.
Why does this thread still then show as active? How can I remove it entirely?
Open mysql client and type
mysql> show processlist;
+-----+------+-----------+------+---------+------+-------+------------------+-----------+---------------+-----------+
| Id | User | Host | db | Command | Time | State | Info | Rows_sent | Rows_examined | Rows_read |
+-----+------+-----------+------+---------+------+-------+------------------+-----------+---------------+-----------+
| 106 | root | localhost | NULL | Query | 0 | NULL | show processlist | 0 | 0 | 0 |
+-----+------+-----------+------+---------+------+-------+------------------+-----------+---------------+-----------+
1 row in set (0.00 sec)
you'll see processes with ID, than you can do this:
mysql> kill 106;
and your process (id = 106) will be killed.
Between the time that phpMyAdmin received the list of processes and the time you clicked to kill one of them, this process had finished by itself.
See also https://sourceforge.net/p/phpmyadmin/feature-requests/1490/.
This phenomenon is caused by the connection used to access PHPmyadmin itself, hence it doesn't show on the direct MySQLQuery. It can't be killed, as it would close the PHPmyadmin connection.

Trying to send mail alert for mysql

how to send mail alert for MySQL?
can we send alerts when the MySQL has large number of connections, or MySQL is not responding properly. Can someone help me to solve this prolem ?
You can do this in a number of ways. SHOW FULL PROCESSLIST; query would give you information about the number of connections as well as the queries being executed by each connection(thread). A sample result is as follows.
mysql> SHOW FULL PROCESSLIST;
+------+------+--------------------+------+---------+------+-------+-----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+------+------+--------------------+------+---------+------+-------+-----------------------+
| 1298 | root | 192.168.1.76:37648 | NULL | Sleep | 0 | | NULL |
| 1491 | root | localhost | NULL | Query | 0 | init | show full processlist |
+------+------+--------------------+------+---------+------+-------+-----------------------+
If you are only concerned with the number of current connection(threads) you can use the following query.
mysql> SHOW STATUS WHERE `variable_name` = 'Threads_connected';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_connected | 2 |
+-------------------+-------+
Now about the mail alerts, you can setup a cron job(shell script) to fire a mail alert as soon as the number of current connections exceed a certain limit. mail command can be used for this.
$ echo "Max MySQL Connections reached"| mail -s "your subject" your#email.com
Also, I came across a great MySQL Monitoring tool- MONyog. It would let you setup mail alerts for any of the MySQL variable.

mysql show processlist query shows state = null

I have a script running a batch of very similar queries.
All of them, except one, run without any problem.
Only one query is getting stuck.
In "show processlist" the query has state=null
According to docs, show processlist should report "State=null" only for the "show processlist" thread itself.
Server version: 5.0.67 MySQL Community Server (GPL)
mysql> show processlist;
+---------+--------+-----------+--------------+---------+------+-------+------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+---------+--------+-----------+--------------+---------+------+-------+------------------------------------------------------------------------------------------------------+
| 3866613 | user | localhost | db_name | Query | 1986 | NULL | select log_time,log_action,log_action_id,log_object_id, #abcde:=if(log_action='abcde',to_ |
| 3873414 | root | localhost | NULL | Query | 0 | NULL | show processlist |
+---------+--------+-----------+--------------+---------+------+-------+------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
Could be a bug of your version of mysql, take a look at this bug for more information .

How to delete sleep process in Mysql

I found that my mysql sever have many of connection who is sleep. i want to delete them all.
so how i can configure my mysql server than then delete or dispose the connection who is in sleep not currently in process.
are this possible to delete this thing in mysql tell me how i can do following
a connection allow only one time datareader open and destroy the connection [process] after giving resposnse of query.
If you want to do it manually you can do like this:
login to Mysql as admin:
mysql -uroot -ppassword;
And than run command:
mysql> show processlist;
You will get something like below :
+----+-------------+--------------------+----------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-------------+--------------------+----------+---------+------+-------+------------------+
| 49 | application | 192.168.44.1:51718 | XXXXXXXX | Sleep | 183 | | NULL ||
| 55 | application | 192.168.44.1:51769 | XXXXXXXX | Sleep | 148 | | NULL |
| 56 | application | 192.168.44.1:51770 | XXXXXXXX | Sleep | 148 | | NULL |
| 57 | application | 192.168.44.1:51771 | XXXXXXXX | Sleep | 148 | | NULL |
| 58 | application | 192.168.44.1:51968 | XXXXXXXX | Sleep | 11 | | NULL |
| 59 | root | localhost | NULL | Query | 0 | NULL | show processlist |
+----+-------------+--------------------+----------+---------+------+-------+------------------+
You will see complete details of different connections. Now you can kill the sleeping connection as below:
mysql> kill 52;
Query OK, 0 rows affected (0.00 sec)
Why would you want to delete a sleeping thread? MySQL creates threads for connection requests, and when the client disconnects the thread is put back into the cache and waits for another connection.
This reduces a lot of overhead of creating threads 'on-demand', and it's nothing to worry about. A sleeping thread uses about 256k of memory.
you can find all working process execute the sql:
show process;
and you will find the sleep process, if you want terminate it, please remember the processid and excute this sql:
kill processid
but actually you can set a timeout variable in my.cnf:
wait_timeout=15
connect_timeout=10
interactive_timeout=100
for me with MySql server on windows,
I update the file (because cannot set variable with sql request due privileges):
D:\MySQL\mysql-5.6.48-winx64\my.ini
add the lines:
wait_timeout=61
interactive_timeout=61
restart service, and acknowledge new values with:
SHOW VARIABLES LIKE '%_timeout';
==> i do a connection tests and after 1 minutes all 10+ connections in sleep are disapeared!