After login to vBulletin Admin Control Panel, and click on “Execute SQL Query” link under the Maintenance section, the administrator may always been denied and rejected with an error message saying “You are not authorized to execute SQL queries”. This is the case even if you’re super administrator who authorized to do everything on the forums. However, a simple trick will grant the user who needs this Execute SQL Query function with the required permission and right.

To grant an user permission and right to run Execute SQL Query from Control Panel, simply login to your web server which is running vBulletin forum. Then edit the /includes/config.php file.

Find the following line:

// ****** USERS WITH QUERY RUNNING PERMISSIONS ******

After a few lines, you should see the following setting:

$canrunqueries = ”;

Add in the user IDs of the forum members, moderators or administrators that you want to enable their ability to be able to run SQL queries in between the quotes (‘). Note that it’s user ID and not user name. User ID is the number assigned to the user account automatically and sequentially. For example, if you want to add the right to administrator, who is usually the first person created on the board, and thus has the user ID number 1, change the line to:

$canrunqueries = ‘1’;

To add more users, simply seperate them with comma (,).