Following errors can occur in MySQL error.log file during start-up:

2018-11-15T14:23:41.871139Z 0 [Warning] Could not increase number of max_open_files to more than 5000 (request: 25010)
2018-11-15T14:23:41.872193Z 0 [Warning] Changed limits: max_connections: 4190 (requested 5000)
2018-11-15T14:23:41.872208Z 0 [Warning] Changed limits: table_open_cache: 400 (requested 10000)

Look into file “/lib/systemd/system/mysql.service” and look for “LimitNOFILE” line.
Most probably you will see limit mentioned in the first line: LimitNOFILE=5000
So you need to increase this limit limit the some reasonable big value (at least as much as is shown in the first line as “request”). But it has several gotchas:

  1. you will have to check limits on OS too:
    • soft limit: ulimit -Sn
    • hard limit: ulimit -Hn
      • If numbers are too small you will have to increase these limits in “/etc/security/limits.conf” – add lines like these:

        mysql soft nofile 65535

        mysql hard nofile 1048576
        (to be on the safe side add the same lines for root user too)
  2. Do not make changes directly into mysql.service file – it will be overwritten during MySQL upgrade – create additional file:
    • sudo mkdir -p /etc/systemd/system/mysql.service.d
      • or mysqld.service.d if you have file mysqld.service
    • in this directory create file “limits.conf” with content:
      • [Service]
          LimitNOFILE =65535
        
  3. After all these changes restart whole instance and all errors should be gone.

Sources of solution: