Mysql error: too many open files

Open file: /etc/security/limits.conf:

1
2
3
4
*         hard    nofile      500000
* soft nofile 500000
root hard nofile 500000
root soft nofile 500000

Open file: /etc/mysql/my.cnf:

1
2
open-files-limit        = 1024000
open_files_limit = 1024000

Restart Mysql:
sudo service mysql restart

References