AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-43

Patrick's questions

Martin Hope
Patrick
Asked: 2013-05-30 12:07:13 +0800 CST

具有订单字段的 drupal 表的正确数据库设计是什么?

  • 1

我正在将自定义小部件添加到 Drupal 6.x 和 MySQL 5.5 的实例中,并遇到了更新行的问题。

我有一个配方成分表,其中多种成分通过节点 ID (nid) 和版本 ID (vid) 绑定到一个配方。

主键是 vid、nid 和 order。

vid & nid 与 recipe nid & vid 字段相关。

表架构是:

+-----------------+------------------+
| Field           | Type             |
+-----------------+------------------+
| vid             | int(10) unsigned |
| nid             | int(10) unsigned |
| order           | int(10) unsigned |
| name            | varchar(255)     |
| unit_of_measure | varchar(32)      |
| quantity        | int(10) unsigned |
+-----------------+------------------+

当试图重新订购配料时,问题就来了。

例如:

+-----+-----+-------+---------+-------------------+----------+
| vid | nid | order |  name   |  unit_of_measure  | quantity |
|  5  |  1  |   1   | Chicken |        Lb         |    1     |
|  5  |  1  |   2   |  Rice   |        Cup        |    2     |
|  5  |  1  |   3   |  Thyme  |        Tbsp       |    3     |
+-----+-----+-------+---------+-------------------+----------+

我想将 Thyme 移到列表的顶部,但我无法将 Thyme 的顺序更改为 1,因为该主键已经存在(Chicken)。我不能将 Chicken 下调到 order 2,因为 Rice 已经在那里,等等......

我的立场是我们应该添加一个唯一的自动递增 int 字段,它将成为唯一的主键。这将使我们能够对行重新排序而不会发生两行可能以相同的 nid、vid 和顺序结束的可能性。

我的同事的立场是,添加一个独特的自动增量 int 字段是糟糕的设计,因为永远不应该有两个不同的行具有相同的 vid、nid 和顺序。但是遵循这种信念,有两种方法可以实现行的重新排序

  1. 使用较大的数字(即 1001、1002、1003)更新每一行的顺序,以便原始顺序不再冲突,然后使用正确的顺序值(1、2、3)更新每一行。
  2. 删除具有相同 nid 和 vid 的每一行,然后以正确的顺序再次插入所有行。

从数据库的角度来看,正确的做法是什么?

database-design drupal
  • 2 个回答
  • 213 Views
Martin Hope
Patrick
Asked: 2012-09-28 18:54:13 +0800 CST

MySQL InnoDB 崩溃事后分析

  • 29

MySQL今天早上在我身上崩溃了。

除了标准的 MySQL 包含的数据库之外,我使用的一切都是 InnoDB。

我试图重新启动 MySQL 守护程序,但它失败了两次。

然后我重新启动了整个服务器,MySQL 正确启动并且从那以后一直运行良好。

初始崩溃的 mysqld 日志文件包含以下内容:

120927 10:21:05 mysqld_safe Number of processes running now: 0
120927 10:21:06 mysqld_safe mysqld restarted
120927 10:21:12 [Note] Plugin 'FEDERATED' is disabled.
120927 10:21:12 InnoDB: The InnoDB memory heap is disabled
120927 10:21:12 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120927 10:21:12 InnoDB: Compressed tables use zlib 1.2.3
120927 10:21:12 InnoDB: Using Linux native AIO
120927 10:21:13 InnoDB: Initializing buffer pool, size = 4.0G
InnoDB: mmap(4395630592 bytes) failed; errno 12
120927 10:21:13 InnoDB: Completed initialization of buffer pool
120927 10:21:13 InnoDB: Fatal error: cannot allocate memory for the buffer pool
120927 10:21:13 [ERROR] Plugin 'InnoDB' init function returned error.
120927 10:21:13 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120927 10:21:13 [ERROR] Unknown/unsupported storage engine: InnoDB
120927 10:21:13 [ERROR] Aborting

120927 10:21:13 [Note] /usr/libexec/mysqld: Shutdown complete

120927 10:21:13 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

尝试重新启动守护程序时,mysqld 日志文件包含:

120927 10:43:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120927 10:43:44 [Note] Plugin 'FEDERATED' is disabled.
120927 10:43:44 InnoDB: The InnoDB memory heap is disabled
120927 10:43:44 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120927 10:43:44 InnoDB: Compressed tables use zlib 1.2.3
120927 10:43:44 InnoDB: Using Linux native AIO
120927 10:43:44 InnoDB: Initializing buffer pool, size = 4.0G
InnoDB: mmap(4395630592 bytes) failed; errno 12
120927 10:43:44 InnoDB: Completed initialization of buffer pool
120927 10:43:44 InnoDB: Fatal error: cannot allocate memory for the buffer pool
120927 10:43:44 [ERROR] Plugin 'InnoDB' init function returned error.
120927 10:43:44 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120927 10:43:44 [ERROR] Unknown/unsupported storage engine: InnoDB
120927 10:43:44 [ERROR] Aborting

120927 10:43:44 [Note] /usr/libexec/mysqld: Shutdown complete

120927 10:43:44 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

服务器重新启动后,mysqld 日志文件包含:

120927 10:46:11 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120927 10:46:11 [Note] Plugin 'FEDERATED' is disabled.
120927 10:46:11 InnoDB: The InnoDB memory heap is disabled
120927 10:46:11 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120927 10:46:11 InnoDB: Compressed tables use zlib 1.2.3
120927 10:46:11 InnoDB: Using Linux native AIO
120927 10:46:11 InnoDB: Initializing buffer pool, size = 4.0G
120927 10:46:11 InnoDB: Completed initialization of buffer pool
120927 10:46:12 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
120927 10:46:12  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
120927 10:46:15  InnoDB: Waiting for the background threads to start
120927 10:46:16 InnoDB: 1.1.8 started; log sequence number 57665645675
120927 10:46:16 [Note] Event Scheduler: Loaded 0 events
120927 10:46:16 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.21-cll'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL) by Atomicorp

我从来没有尝试解密崩溃的 MySQL 日志文件。

我正在使用版本:5.5.21-cll MySQL Community Server (GPL) by Atomicorp

关于我应该从哪里开始的任何想法?

更新:根据@Michael-sqlbot 的建议,我提取了系统日志并发现了这一点:

Sep 27 10:20:58 ip-97-74-197-181 kernel: pcscd invoked oom-killer: gfp_mask=0xd0, order=0, oomkilladj=0
Sep 27 10:21:00 ip-97-74-197-181 kernel:
Sep 27 10:21:00 ip-97-74-197-181 kernel: Call Trace:
Sep 27 10:21:00 ip-97-74-197-181 kernel:  [<ffffffff800c9f35>] out_of_memory+0x8e/0x2f3
Sep 27 10:21:00 ip-97-74-197-181 kernel:  [<ffffffff8002dfc7>] __wake_up+0x38/0x4f
Sep 27 10:21:00 ip-97-74-197-181 kernel:  [<ffffffff8000f67d>] __alloc_pages+0x27f/0x308
Sep 27 10:21:00 ip-97-74-197-181 kernel:  [<ffffffff80017a84>] cache_grow+0x139/0x3c7
Sep 27 10:21:00 ip-97-74-197-181 kernel:  [<ffffffff8005be28>] cache_alloc_refill+0x138/0x188
Sep 27 10:21:00 ip-97-74-197-181 kernel:  [<ffffffff8000ad2e>] kmem_cache_alloc+0x6c/0x76
Sep 27 10:21:00 ip-97-74-197-181 kernel:  [<ffffffff80012877>] getname+0x25/0x1c2
Sep 27 10:21:00 ip-97-74-197-181 kernel:  [<ffffffff8001a04b>] do_sys_open+0x17/0xbe
Sep 27 10:21:00 ip-97-74-197-181 kernel:  [<ffffffff8005d28d>] tracesys+0xd5/0xe0
Sep 27 10:21:00 ip-97-74-197-181 kernel:
Sep 27 10:21:11 ip-97-74-197-181 kernel: Mem-info:
Sep 27 10:21:20 ip-97-74-197-181 kernel: Node 0 DMA per-cpu:
Sep 27 10:21:27 ip-97-74-197-181 kernel: cpu 0 hot: high 0, batch 1 used:0
Sep 27 10:21:38 ip-97-74-197-181 kernel: cpu 0 cold: high 0, batch 1 used:0
Sep 27 10:21:49 ip-97-74-197-181 kernel: cpu 1 hot: high 0, batch 1 used:0
Sep 27 10:21:49 ip-97-74-197-181 kernel: cpu 1 cold: high 0, batch 1 used:0
Sep 27 10:21:49 ip-97-74-197-181 kernel: cpu 2 hot: high 0, batch 1 used:0
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 2 cold: high 0, batch 1 used:0
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 3 hot: high 0, batch 1 used:0
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 3 cold: high 0, batch 1 used:0
Sep 27 10:21:52 ip-97-74-197-181 kernel: Node 0 DMA32 per-cpu:
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 0 hot: high 186, batch 31 used:60
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 0 cold: high 62, batch 15 used:57
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 1 hot: high 186, batch 31 used:139
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 1 cold: high 62, batch 15 used:61
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 2 hot: high 186, batch 31 used:47
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 2 cold: high 62, batch 15 used:57
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 3 hot: high 186, batch 31 used:52
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 3 cold: high 62, batch 15 used:53
Sep 27 10:21:52 ip-97-74-197-181 kernel: Node 0 Normal per-cpu:
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 0 hot: high 186, batch 31 used:29
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 0 cold: high 62, batch 15 used:17
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 1 hot: high 186, batch 31 used:178
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 1 cold: high 62, batch 15 used:52
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 2 hot: high 186, batch 31 used:22
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 2 cold: high 62, batch 15 used:59
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 3 hot: high 186, batch 31 used:71
Sep 27 10:21:52 ip-97-74-197-181 kernel: cpu 3 cold: high 62, batch 15 used:54
Sep 27 10:21:52 ip-97-74-197-181 kernel: Node 0 HighMem per-cpu: empty
Sep 27 10:21:52 ip-97-74-197-181 kernel: Free pages:       41728kB (0kB HighMem)
Sep 27 10:21:52 ip-97-74-197-181 kernel: Active:1031140 inactive:970428 dirty:0 writeback:0 unstable:0 free:10432 slab:4277 mapped-file:801 mapped-anon:1993003 pagetables:11636
Sep 27 10:21:52 ip-97-74-197-181 kernel: Node 0 DMA free:10096kB min:12kB low:12kB high:16kB active:0kB inactive:0kB present:9700kB pages_scanned:0 all_unreclaimable? yes
Sep 27 10:21:52 ip-97-74-197-181 kernel: lowmem_reserve[]: 0 2965 8015 8015
Sep 27 10:21:52 ip-97-74-197-181 kernel: Node 0 DMA32 free:24424kB min:4236kB low:5292kB high:6352kB active:1544164kB inactive:1428756kB present:3037024kB pages_scanned:7185900 all_unreclaimable? yes
Sep 27 10:21:52 ip-97-74-197-181 kernel: lowmem_reserve[]: 0 0 5050 5050
Sep 27 10:21:52 ip-97-74-197-181 kernel: Node 0 Normal free:7208kB min:7212kB low:9012kB high:10816kB active:2580172kB inactive:2453052kB present:5171200kB pages_scanned:12935183 all_unreclaimable? yes
Sep 27 10:21:52 ip-97-74-197-181 kernel: lowmem_reserve[]: 0 0 0 0
Sep 27 10:21:52 ip-97-74-197-181 kernel: Node 0 HighMem free:0kB min:128kB low:128kB high:128kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no
Sep 27 10:21:52 ip-97-74-197-181 kernel: lowmem_reserve[]: 0 0 0 0
Sep 27 10:21:52 ip-97-74-197-181 kernel: Node 0 DMA: 6*4kB 3*8kB 4*16kB 4*32kB 4*64kB 5*128kB 1*256kB 1*512kB 0*1024kB 0*2048kB 2*4096kB = 10096kB
Sep 27 10:21:52 ip-97-74-197-181 kernel: Node 0 DMA32: 24*4kB 3*8kB 1*16kB 1*32kB 1*64kB 3*128kB 1*256kB 0*512kB 1*1024kB 1*2048kB 5*4096kB = 24424kB
Sep 27 10:21:52 ip-97-74-197-181 kernel: Node 0 Normal: 0*4kB 13*8kB 8*16kB 0*32kB 19*64kB 1*128kB 2*256kB 0*512kB 1*1024kB 0*2048kB 1*4096kB = 7208kB
Sep 27 10:21:52 ip-97-74-197-181 kernel: Node 0 HighMem: empty
Sep 27 10:21:52 ip-97-74-197-181 kernel: 9391 pagecache pages
Sep 27 10:21:52 ip-97-74-197-181 kernel: Swap cache: add 5745145, delete 5744809, find 81873079/82270945, race 0+63
Sep 27 10:21:52 ip-97-74-197-181 kernel: Free swap  = 0kB
Sep 27 10:21:52 ip-97-74-197-181 kernel: Total swap = 2096472kB
Sep 27 10:21:52 ip-97-74-197-181 kernel: Free swap:            0kB
Sep 27 10:21:52 ip-97-74-197-181 kernel: 2359296 pages of RAM
Sep 27 10:21:52 ip-97-74-197-181 kernel: 324458 reserved pages
Sep 27 10:21:52 ip-97-74-197-181 kernel: 21388 pages shared
Sep 27 10:21:52 ip-97-74-197-181 kernel: 336 pages swap cached
Sep 27 10:21:52 ip-97-74-197-181 kernel: Out of memory: Killed process 3044, UID 27, (mysqld).
mysql innodb
  • 4 个回答
  • 16261 Views
Martin Hope
Patrick
Asked: 2012-02-12 14:09:44 +0800 CST

如何更新 mysql my.cnf 而不会出错?

  • 2

我更新了 MySQLmy.conf文件并重新启动了我的服务器,没有出现任何问题。

一旦我尝试访问一个表,我就收到了错误

mysql #1033 - Incorrect information in file: 

我将my.cnf文件恢复为原始文件,服务器工作正常。

我正在寻找更新一些 innodb 设置:

innodb_buffer_pool_size
innodb_additional_mem_pool_size
innodb_log_file_size
innodb_log_buffer_size

我想我看到我必须my.cnf在服务器上创建任何数据库之前更新文件,但这似乎不对。

my.cnf在服务器上创建数据库后,有没有办法更新文件?

CentOS 5.6

MySQL 5.0.77

原来的:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

新的:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# This is my configuration!
innodb_buffer_pool_size=4G
innodb_additional_mem_pool_size=20M

innodb_log_file_size=1G
innodb_log_buffer_size=8M

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
mysql innodb
  • 1 个回答
  • 3443 Views
Martin Hope
Patrick
Asked: 2011-03-18 12:56:41 +0800 CST

在 MySQL 中,WHERE 子句中列的顺序会影响查询性能吗?

  • 47

我在某些可能具有大量结果集的数据库查询上遇到性能问题。

有问题的查询,我AND在 WHERE 子句中有三个

条款的顺序重要吗?

如,如果我将 ASI_EVENT_TIME 子句放在首位(因为这会从任何子句中删除大部分结果。

这会改善查询的运行时间吗?

询问:

SELECT DISTINCT  activity_seismo_info.* 
FROM `activity_seismo_info` 
WHERE 
    activity_seismo_info.ASI_ACTIVITY_ID IS NOT NULL  AND 
    activity_seismo_info.ASI_SEISMO_ID IN (43,44,...,259) AND 
    (
        activity_seismo_info.ASI_EVENT_TIME>='2011-03-10 00:00:00' AND 
        activity_seismo_info.ASI_EVENT_TIME<='2011-03-17 23:59:59'
    ) 

ORDER BY activity_seismo_info.ASI_EVENT_TIME DESC

查询说明:

+----+-------------+---------+-------+---------------------------+--------------+---------+------+-------+-----------------------------+ 
| id | select_type | table   | type  | possible_keys             | key          | key_len | ref  | rows  | Extra                       |
+----+-------------+---------+-------+---------------------------+--------------+---------+------+-------+-----------------------------+ 
|  1 | SIMPLE      | act...o | range | act...o_FI_1,act...o_FI_2 | act...o_FI_1 | 5       | NULL | 65412 | Using where; Using filesort |
+----+-------------+---------+-------+---------------------------+--------------+---------+------+-------+-----------------------------+

使用:

PHP 5.2

MySQL 5.0.51a-3ubuntu5.4

推进 1.3

Symfony 1.2.5

mysql performance
  • 6 个回答
  • 40674 Views
Martin Hope
Patrick
Asked: 2011-03-04 12:37:00 +0800 CST

MySQL 连接睡眠“太长”需要多长时间?

  • 41

我登录到我的服务器以检查数据库的状态,并注意到SHOW PROCESSLIST;有大量非常旧的连接处于休眠状态。

在此处输入图像描述 在连接被终止之前,连接时间限制应该是多长时间?

如何在 MySQL 5.0.51a-3ubuntu5.4 中设置时间限制?

笔记:

我正在使用 PHP 5.2.x 和 symfony 框架 1.2。

mysql mysql-5
  • 1 个回答
  • 134519 Views
Martin Hope
Patrick
Asked: 2011-02-23 08:50:55 +0800 CST

MySQL INNODB SELECT 查询挂在复制到 tmp 表

  • 6

我有一个在特定查询上随机挂起(看似)的查询。我的大多数网站用户在运行此查询时都没有问题,但少数用户在网站上遇到超时问题,当我检查processlist它时卡住了copying to tmp table。

我相信硬盘驱动器跟不上,这导致复制到 tmp 表时挂起。

我不相信我可以更有效地优化查询。我想知道是否可以将服务器的第二个硬盘驱动器设置为临时表存储,这样我就可以分散服务器上的一些负载。

The query:
SELECT DISTINCT  
    activity_seismo_info.ID, 
    activity_seismo_info.CREATED_AT, 
    activity_seismo_info.UPDATED_AT, 
    ....    
    activity_seismo_info.ASI_EXTRA_5, 
    seismo.ID, 
    ....    
    seismo.SEISMO_NOTES 

FROM `activity_seismo_info` 
    JOIN activity_info ON (activity_seismo_info.ASI_ACTIVITY_ID=activity_info.ID) 
    JOIN location ON (activity_info.ACTIVITY_LOCATION_ID=location.ID) 
    LEFT JOIN seismo ON (activity_seismo_info.ASI_SEISMO_ID=seismo.ID) 

WHERE location.ID='193' 

ORDER BY activity_info.ACTIVITY_EVENT_TIME DESC LIMIT 30

我在一个有 2GB RAM 和两个硬盘驱动器的 P4 上(第二个硬盘驱动器没有使用)

PHP5.2

MySQL 5.0.51a-3ubuntu5.4

带有 Propel 的 symfony 1.2 应用程序

更新

感谢@DTest 的建议,我发现我的查询在对结果进行限制之前返回了表中的所有行。但为了将来参考,有没有办法设置 MySQL 使用第二个硬盘驱动器作为临时表的“临时”驱动器?

mysql performance
  • 1 个回答
  • 5232 Views
Martin Hope
Patrick
Asked: 2011-01-28 06:59:04 +0800 CST

在 MySQL 中存储大量小尺寸条目

  • 3

我有一个数据库,用于存储来自多个仪表的读数。根据仪表的不同,该仪表可能每 1-5 分钟就会有多个读数的数据(即气象站,它存储 5 个不同的读数)。

我目前按日期存储数据。我将单个日期的特定仪表的所有内容分组在一起,并将其作为 xml 存储在文本列中。

将这些数据存储为单独的行会更有效吗?

我正在尝试确定哪个是长期最明智的解决方案(即每行数据更多的行更少,或者行更多,每行更小)。

这是一个阅读繁重的环境。

编辑:

通过“高效”,我最关心速度和资源使用情况(如果我提取一年的数据,这将是处理器/内存密集度最低的)。

我几乎完全使用这些数据为客户绘制图表。每个时间戳的读数数量是可变的,从 1 到 6 个读数。

该数据库当前是一个 INNODB。

编辑 2:

我更倾向于将数据保存在 MySQL 中以便于访问/更新。

我正在寻找更多的答案是将每个单独的时间戳(可能有多个读数)保存在单独的行中还是将多个时间戳(即最多一天的值)分组到一行中是否更聪明。

谢谢

mysql mysql-5
  • 3 个回答
  • 930 Views
Martin Hope
Patrick
Asked: 2011-01-26 18:51:31 +0800 CST

更改了 max_allowed_pa​​cket 并仍然收到“数据包太大”错误

  • 8

我使用 mysqldump 创建一个用于备份的平面文件。我已使用此文件在备用服务器上重新创建数据库。我在命令行上通过 ssh 运行导入过程,但收到多个Packet too Large错误。

我用更大的 max_allowed_pa​​cket(即 1000M)重新启动了 mysql,但仍然收到错误。我什至尝试在导入文件中设置 max_allowed_pa​​cket,仍然收到错误。

有没有办法确保设置 max_allowed_pa​​cket 和/或使用 mysqldump 来创建一个不会导致此问题的文件?

以供参考:

未压缩的 mysqldump 文件约为 2GB

数据库类型为 INNODB

mysql backup
  • 3 个回答
  • 8568 Views
Martin Hope
Patrick
Asked: 2011-01-06 08:28:34 +0800 CST

基于用户的不同登录凭据

  • 6

我为我的公司运行一个 PHP symfony-framework 网络应用程序,它对所有连接使用单一数据库登录,无论用户是管理员还是客户端。

我知道更高安全性的系统通常对不同级别的用户使用不同的登录名。

无论是否使用框架,这是我应该使用的安全功能吗?

应用程序是基于 Web 还是基于 Intranet 是否重要?

澄清一下:我是否应该关心为 symfony 创建一个插件来实现多个数据库登录,我是否应该为我创建的任何其他不基于框架的应用程序这样做?

如果您想知道,我正在使用 PHP5 和 MySQL。

mysql security
  • 2 个回答
  • 477 Views
Martin Hope
Patrick
Asked: 2011-01-04 13:13:48 +0800 CST

如何优化大型数据库的 mysqldump?

  • 202

我有一个 symfony 应用程序,其 InnoDB 数据库约为 2GB,有 57 个表。数据库的大部分大小位于单个表中(~1.2GB)。我目前正在使用 mysqldump 每晚备份数据库。

由于我的 comcast 连接,通常如果我手动运行转储,我与服务器的连接将在转储完成之前超时,导致我不得不重新运行转储。[我目前运行一个每晚执行转储的 cron,这仅适用于我手动运行的转储。]

有没有办法加快连接超时问题的转储,但也可以限制服务器被此进程占用的时间?

顺便说一句,我目前正在努力减少整个数据库的大小以解决这个问题。

mysql performance
  • 7 个回答
  • 273455 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve