run a system command from a mysql query ?

Posted on 2004-11-28
Medium Priority
Last Modified: 2008-03-06
hi !

strugling with mod_quotatab for proftpd, i have imagined a solution consisting of running a system command in a mysql query.
Such as "update some_table set directory_size='`du -ks /path/to/somedir/`'"

is there some way to do this  ?


PS : this MUST consist of one (or several) mysql queries

my question about mod_quotatab was here : http://www.experts-exchange.com/Operating_Systems/Linux/Q_21221788.html

Question by:safarlebus
LVL 48

Accepted Solution

hernst42 earned 1500 total points
ID: 12690010
AFAIK there is no way to do such a thing in the SQL-Statement directly for mysql.
You can use other script-language (shell, php) to execute that command, get the result and then execute that query with the given result, but in plain SQL it is not supported.

Oracle has such an ability (http://www.akadia.com/services/ora_extproc_nt.html), but mysql AFAIK not.
LVL 17

Expert Comment

ID: 12693196
I can tell you right now that this cannot be done. Sorry, but hernst42 is correct, you will have to depend on an external programming or scripting language.

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month14 days, 11 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question