1

I need to increase max_prepared_stmt_count, and I can do that easily by running

set global max_prepared_stmt_count=50000;

The problem, though, is that number gets reset to the default everytime after a reboot. I've tried adding in lines like

max_prepared_stmt_count=50000;

into various config files, but they spit out the same error:

mysql: [ERROR] unknown variable 'max_prepared_stmt_count=50000'

Anybody know what I'm doing wrong?

2
  • In what conf files do you set it and what MySQL version do you use? It should be set in /etc/my.cnf – esoroka Nov 6 '19 at 5:06
  • Make sure you add the setting to the [mysqld] section. And don't add the semicolon. – wurtel Nov 6 '19 at 7:52
2

You should add it in /etc/my.cnf on this way:

[mysqld]
max_prepared_stmt_count = 50000
6
  • I don't have that file. Should I create it? I do have /etc/mysq/my.cnf and /etc/mysql/mysql.cnf. – Taylor Nov 6 '19 at 13:12
  • edit it in /etc/mysql/mysql.cnf (if this is the config of your mysql instance) – Romeo Ninov Nov 6 '19 at 13:13
  • Didn't work. Still shows default variable like 16382 when I type show variables like 'max_prepared_stmt_count'; – Taylor Nov 6 '19 at 13:17
  • @Taylor, did you restart mysql after config file change? – Romeo Ninov Nov 6 '19 at 13:18
  • 1
    Yay, works. I typed sudo /etc/init.d/mysql restart and checked. Thanks very much – Taylor Nov 6 '19 at 13:22
0

For people running MySQL on AWS RDS, you can create your own Parameter Group and set the value of max_prepared_stmt_count there:

  1. AWS Console -> RDS
  2. RDS -> Parameter Groups
  3. Create Parameter Group
  4. Give it a name
  5. Back to Parameter Groups, select the group you created
  6. In the search bar at the top, type max_prepared_stmt_count
  7. Click the checkbox on the left to select the row
  8. Click Edit Parameter in the top right corner
  9. Update the value in the row
  10. Click Save Changes in the top right corner

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.