mySQL Timeout value

Prev Next

So you are running your own dedicated server - be it physical or virtual and you have MySQL installed on your server.

A common error that can occur with CMS or CRM applications - the information required for a particular function may take a while to query from the database - and you may sometimes receive an error message stating the SQL query failed due to the timeout being reached.

Warning

This requires some command line knowledge and access to the server via SSH console.

Adjust MySQL Timeout Value

  1. Log in to the server via SSH

  2. Use your favourite Text editor, usually either VIM or NANO

  3. Type in and hit enter: vim /etc/my.cnf

  4. Locate the line: connect_timeout

  5. Change the timeout value to a higher value (the value is in seconds): connect_timeout = 300

  6. Restart the MySQL service.

    Example on a cPanel Server: /scripts/restartsrv_mysql OR systemctl status mysqld

This will now resolve your timeout issue with MySQL queries.