Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8497101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:02:01+00:00 2026-06-11T00:02:01+00:00

I am trying to execute a shell command from within mysql (from within a

  • 0

I am trying to execute a shell command from within mysql (from within a procedure or a trigger or the command line for mysql).

I have added lib_mysqludf_sys to the mysql plugins and created the functions that are available with the library. (the library) home page

The library has 5 functions.

  1. sys_set – to set $PATH – this works and stores the $PATH which i can later check.
  2. sys_get – to get the stored value of $PATH – this also works and returns the value that I have stored.
  3. sys_exec – to execute a command in the system and return the exit code.
  4. sys_eval – to execute a command in the system and return the standard output.
  5. lib_mysqludf_sys_info – return the current version of the library – this also works.

I need sys_exec and sys_eval to work correctly.

I think I have found the problem in my search but cannot solve it.

mysql is limited by apparmor and is not granted access to execute system commands by the default apparmor profile. I have tried the commands in the documentation to disable a single profile, disable the framework, putting all profiles except one into enforce mode and putting all profiles in complain mode. Nothing works. the command

sudo apparmor_status

always gives me the same output.

20 profiles are loaded.
20 profiles are in enforce mode.
  /opt/extras.ubuntu.com/unity-lens-askubuntu/unity-askubuntu-daemon
  /sbin/dhclient
  /usr/bin/evince
  /usr/bin/evince-previewer
  /usr/bin/evince-previewer//launchpad_integration
  /usr/bin/evince-previewer//sanitized_helper
  /usr/bin/evince-thumbnailer
  /usr/bin/evince-thumbnailer//sanitized_helper
  /usr/bin/evince//launchpad_integration
  /usr/bin/evince//sanitized_helper
  /usr/lib/NetworkManager/nm-dhcp-client.action
  /usr/lib/connman/scripts/dhclient-script
  /usr/lib/cups/backend/cups-pdf
  /usr/lib/lightdm/lightdm/lightdm-guest-session-wrapper
  /usr/lib/telepathy/mission-control-5
  /usr/lib/telepathy/telepathy-*
  /usr/sbin/cupsd
  /usr/sbin/mysqld
  /usr/sbin/tcpdump
  /usr/share/gdm/guest-session/Xsession
0 profiles are in complain mode. 
5 processes have profiles defined. 
5 processes are in enforce mode.    
  /sbin/dhclient (2537)     
  /usr/lib/telepathy/mission-control-5 (2709)  
  /usr/sbin/cupsd (12245)     
  /usr/sbin/cupsd (12250)     
  /usr/sbin/mysqld (12675)  
0 processes are in complain mode. 
0 processes are unconfined but have a profile defined.

Please tell me how I could disable apparmor or change the profile for mysql so that it has access to executing system commands.

The reason I am doing all this is so that I can execute a system command when somethings happen in the DB (via a DB trigger), if you have suggestion for some other ways in which this can be easily implemented then please mention those too.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:02:02+00:00Added an answer on June 11, 2026 at 12:02 am

    managed to get this working. First put apparmor in complain mode for the necessary profiles then used apparmor’s interactive tools (aa-genprof/aa-logprof) to configure the profile for mysqld

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to execute a shell command from a java application, on the GNU/Linux
I`m trying to execute a shell command with arguments in C# , and The
I am trying to execute remote commands from within a php script over ssh,
Is it possible to execute shell script in command line like this : counter=`ps
I am trying to run a shell from my python program. I have used
I am trying to run a shell script from within a .vimrc file (three
I am trying to execute a command using function calls in a shell script.
I`m trying to execute linux commant 'cat' from java code, but it does not
I'm trying to execute command prompt commands and read the output in C#. This
I'm trying to execute a PowerShell script from a c# application. The script has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.