# MySQL with mysql_limits="YES" problem



## adi (Jun 28, 2012)

Hello

FreeBSD 9.0-RELEASE-p3 64 Bit, MySQL 5.5.25 from ports, proce*s*sor i7 4 cores + HT, 16 GB RAM. 

Problem: memory allocation when start with 
	
	



```
mysql_limits="YES"
```

When I start MySQL from root account (with very liberal login.conf settings) running fine.
tuning-primer.sh (MYSQL PERFORMANCE TUNING PRIMER) shows values: 


```
INNODB STATUS
Current InnoDB index space = 256 K
Current InnoDB data space = 320 K
Current InnoDB buffer pool free = 98 %
Current innodb_buffer_pool_size = 384 M
....
MEMORY USAGE
Max Memory Ever Allocated : 852 M
Configured Max Per-thread Buffers : 1.82 G
Configured Max Global Buffers : 828 M
Configured Max Memory Limit : 2.63 G
```

Now I try run MySQL with: 
	
	



```
mysql_limits="YES"
```
 in /etc/rc.conf.

User li*m*its:

```
limits -Umysql
Resource limits for class mysql:
  cputime                  7200 secs
  filesize             16777216 kB
  datasize              5242880 kB
  stacksize               20480 kB
  coredumpsize                0 kB
  memoryuse             6291456 kB
  memorylocked            65536 kB
  maxprocesses              128
  openfiles                8000
  sbsize               infinity bytes
  vmemoryuse             512000 kB
  pseudo-terminals     infinity
  swapuse              infinity kB
```
 
General system limits

```
kern.maxssiz: 536870912
kern.dflssiz: 8388608
kern.maxdsiz: 34359738368
kern.dfldsiz: 134217728
kern.maxtsiz: 134217728
```

Error when I start with 
	
	



```
mysql_limit="YES"
```


```
120627 09:31:24 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
120627  9:31:24 InnoDB: The InnoDB memory heap is disabled
120627  9:31:24 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120627  9:31:24 InnoDB: Compressed tables use zlib 1.2.5
120627  9:31:24 InnoDB: Initializing buffer pool, size = 384.0M
InnoDB: mmap(412090368 bytes) failed; errno 12
120627  9:31:24 InnoDB: Completed initialization of buffer pool
120627  9:31:24 InnoDB: Fatal error: cannot allocate memory for the buffer pool
```

Can you help me say what can I change to run MySQL with mysql user limits?

my.cnf (part about INNODB)


```
innodb_buffer_pool_size = 384M
innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 100M
innodb_log_buffer_size = 8M
```


----------

