简体   繁体   English

PDOException:SQLSTATE [HY000]:一般错误:3 写入文件“/tmp/MYHKgYpv”时出错(错误代码:28)

[英]PDOException: SQLSTATE[HY000]: General error: 3 Error writing file '/tmp/MYHKgYpv' (Errcode: 28)

I have installed Visitor Module Drupal 7. I have viewed the reports using www.domain.com/visitors.我已经安装了Visitor Module Drupal 7。我已经使用 www.domain.com/visitors 查看了报告。 All the reports are working well.所有报告都运作良好。 But when i view the user activity report it shows below error.但是当我查看用户活动报告时,它显示以下错误。

PDOException: SQLSTATE[HY000]: General error: 3 Error writing file '/tmp/MYHKgYpv' (Errcode: 28): SELECT u.name AS name, u.uid AS uid, COUNT(DISTINCT v.visitors_id) AS hits, COUNT(DISTINCT n.nid) AS nodes, COUNT(DISTINCT c.cid) AS comments FROM {users} u LEFT OUTER JOIN {visitors} v ON u.uid=v.visitors_uid LEFT OUTER JOIN {node} n ON u.uid=n.uid LEFT OUTER JOIN {comment} c ON u.uid=c.uid WHERE (visitors_date_time BETWEEN:db_condition_placeholder_0 AND:db_condition_placeholder_1) GROUP BY u.name, u.uid, v.visitors_uid, n.uid, c.uid ORDER BY hits DESC LIMIT 10 OFFSET 0; PDOException:SQLSTATE [HY000]:一般错误:3 写入文件“/tmp/MYHKgYpv”时出错(Errcode:28):SELECT u.name AS name,u.uid AS uid,COUNT(DISTINCT v.visitors_id)AS hits,COUNT (DISTINCT n.nid) 作为节点,COUNT(DISTINCT c.cid) 作为来自 {users} 的评论 u LEFT OUTER JOIN {visitors} v ON u.uid=v.visitors_uid LEFT OUTER JOIN {node} n ON u.uid= n.uid LEFT OUTER JOIN {comment} c ON u.uid=c.uid WHERE (visitors_date_time BETWEEN:db_condition_placeholder_0 AND:db_condition_placeholder_1) GROUP BY u.name, u.uid, v.visitors_uid, n.uid, c.uid ORDER BY 命中 DESC LIMIT 10 OFFSET 0; Array ( [:db_condition_placeholder_0] => 1451606400 [:db_condition_placeholder_1] => 1452556799 ) in PagerDefault->execute() (line 79 of /home/legalmon/public_html/includes/pager.inc). PagerDefault->execute() 中的数组 ( [:db_condition_placeholder_0] => 1451606400 [:db_condition_placeholder_1] => 1452556799 (/home/legalmon/public_html/includes/pager.inc 第 79 行)。

How can i fix this issue?我该如何解决这个问题?

You should continuously check your /tmp folder size while triggering "USER REPORT Query".您应该在触发“USER REPORT 查询”时不断检查您的 /tmp 文件夹大小。

If /tmp directory is 100% utilized you would experience this error.如果 /tmp 目录被 100% 使用,您将遇到此错误。

Solution is to mount some GB's to /tmp directory or set new location of MySQL tmp.解决方案是将一些 GB 挂载到 /tmp 目录或设置 MySQL tmp 的新位置。

To setting up New location:设置新位置:

Create a directory anywhere you have enough space(can be the "/" root directory)

# mkdir /home/mysqltmp

Give write permissions

# chmod 1777 /home/mysqltmp

Open MY.CNF File

# /etc/my.cnf 

Add below line under the [mysqld] section and save the file

# tmpdir=/home/mysqltmp

Restart MySQL

# /etc/init.d/mysql restart

Check new location

# mysqladmin var | grep tmpdir

This should show following return.

| slave_load_tmpdir                       | /home/mysqltmp
| tmpdir                                  | /home/mysqltmp

Done !!完毕 !!

Try refresh the Page.尝试刷新页面。

First, check with df -h if the storage device is nearly full , if that's the case, then you need to free up some space.首先,使用df -h检查存储设备是否快满了,如果是这种情况,那么您需要释放一些空间。

Deleting old databases may be solution, but if you don't see a change in free space after the purge, then you need to do the following:删除旧数据库可能是解决方案,但如果清除后您没有看到可用空间发生变化,则需要执行以下操作:

There's a common problem with some MySQL configurations in which all databases are stored in a single file called ibdata1 .一些 MySQL 配置存在一个常见问题,其中所有数据库都存储在一个名为ibdata1的文件中。 What happens is that when you delete old databases this file does not shrink automatically.发生的情况是,当您删除旧数据库时,该文件不会自动收缩。

Check the size of the files in /var/lib/mysql/ and if you see that ibdata1 size doesn't change after deleting some old databases, then you need to do some clean up.检查/var/lib/mysql/中文件的大小,如果您发现删除一些旧数据库后ibdata1大小没有改变,那么您需要进行一些清理。

Steps:脚步:

  1. Backup your databases备份你的数据库
  2. Delete your databases删除你的数据库
  3. Delete ibdata1 using rm /var/lib/mysql/ibdata1使用rm /var/lib/mysql/ibdata1
  4. Delete ib_logfile(s) using rm /var/lib/mysql/ib_logfile*使用rm /var/lib/mysql/ib_logfile*删除 ib_logfile(s)
  5. Restart MySQL with service mysql restart使用service mysql restart重启 MySQL
  6. Import your backed up databases.导入备份的数据库。

Now, there should be enough space for /tmp to grow and execute your queries!现在, /tmp应该有足够的空间来增长和执行您的查询!

Good luck!祝你好运!

Notes:笔记:

For more details on the purging visit John P's answer here: https://stackoverflow.com/a/3456885/2188595有关清除的更多详细信息,请在此处访问 John P 的回答: https ://stackoverflow.com/a/3456885/2188595

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 致命错误:未捕获的 PDOException:SQLSTATE[HY000]:一般错误 - Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error PDOException:SQLSTATE[HY000]:一般错误:7890 找不到文件 - PDOException : SQLSTATE[HY000]: General error: 7890 Can't find file Symfony 错误:[PDOException] SQLSTATE[HY000] [2002] 没有这样的文件或目录 - Symfony Error: [PDOException] SQLSTATE[HY000] [2002] No such file or directory SQLSTATE [HY000]:常规错误:13无法获取“ ./pics”的统计信息(错误代码:13-权限被拒绝) - SQLSTATE[HY000]: General error: 13 Can't get stat of './pics' (Errcode: 13 - Permission denied) SQLSTATE [HY000]:一般错误:2053 - SQLSTATE[HY000]: General error: 2053 SQLSTATE [HY000]:一般错误和array(0){} - SQLSTATE[HY000]: General error and array(0){} 为什么SQLSTATE [HY000]:一般错误? - Why SQLSTATE[HY000]: General error? 致命错误:未捕获异常'PDOException',消息'SQLSTATE [HY000]:常规错误'中 - Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error' in SQLSTATE [HY000]:一般错误 - SQLSTATE[HY000]: General error Laravel 5.0 [PDOException] SQLSTATE [HY000]:常规错误:1215无法添加外键约束 - Laravel 5.0 [PDOException] SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM