mysql init-file config option giving file not found error
Thanks @quanta, the problem was indeed apparmor.
To fix the issue:
Edit the mysql apparmor file:
sudo emacs -nw /etc/apparmor.d/usr.sbin.mysqld
Include the folder where your init-file lives with the *.sql extension:
...
/usr/sbin/mysqld {
/var/log/mysql.log rw,
/var/log/mysql.err rw,
;/var/lib/mysql/ r,
/var/lib/mysql/** rwk,
/var/log/mysql/ r,
/var/log/mysql/* rw,
/{,var/}run/mysqld/mysqld.pid w,
/{,var/}run/mysqld/mysqld.sock w,
/sys/devices/system/cpu/ r,
# I added to allow my init-file script to run
/etc/mysql/*.sql r,
}
And then make AppArmor reload the profiles.
# sudo /etc/init.d/apparmor reload
Then reload mysql:
sudo /etc/init.d/mysql restart
Now the init-file gets executed. Yay!
Related videos on Youtube
razor_ray
Updated on September 18, 2022Comments
-
razor_ray over 1 year
I'm making a Microsoft Word addin that integrates with our EDRMS software.
On this addin, there is a button that will create a new Word Document and save it into the EDRMS.
However, this button is also available when an existing Document is opened too.
I want to be able to add some sort of validation so that if the User clicks on the "Create New" button on an existing Document, a message box appears saying that the Document already exists.
I have been using the foreach loop, which does not work well as it stops at the first result.
What is the best loop that I can use that will go through all the results first then determine if the document exists or if a new document can be created.
My code is below:
private void btnNewDoc_Click(object sender, EventArgs e) { try { string docName = Globals.ThisAddIn.Application.ActiveDocument.Name; string res = Path.GetFileNameWithoutExtension(docName); string fileloc = Path.GetFullPath(docName); //searches through all existing documents that are checked out to me TrimMainObjectSearch recser = new TrimMainObjectSearch(db, BaseObjectTypes.Record); recser.SetSearchString("checkedOutBy:me"); foreach (Record resultRecord in recser) { //if the document doesnt appear in the checked out results, then create the new document if (res != resultRecord.Title) { //code to create the new doc } //otherwise display a message else { MessageBox.Show("This is an existing document - " + resultRecord.Number.ToString()); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
-
Greg Petersen over 12 yearsWhat is the output of
file /etc/mysql/mysqlinit.sql
? -
Tom over 12 years
file /etc/mysql/mysqlinit.sql
gives "/etc/mysql/mysqlinit.sql: ASCII text, with no line terminators" -
Greg Petersen over 12 yearsTo narrow down the problem, just try to move it to
/tmp
folder to see what happens. Are you running AppArmor? -
Tom over 12 yearsI tried using a init-file in
/tmp
but no luck. Yes, I think Ubuntu uses AppArmor. -
Greg Petersen over 12 yearsIf so, try to stop AppArmor and see if the error go away.
-
lilezek over 8 yearsI have been using the foreach loop, which does not work well as it stops at the first result. A loop only stops if you explicitly tell to do so, or there are no more items to iterate over.
-
TheEvilPenguin over 8 yearsThe
foreach
loop will behave the same as any other loop in this respect. Is the problem being caught by theres != resultRecord.Title
test, or is an exception being thrown? An exception not caught inside the loop will break out of any loop. -
MethodMan over 8 yearscan you explain what the value of
res
is and whatresultRecord.Title
is when you make your first iteration..? this will determine if you need a break; statement inside the foreach or not.. if worse comes to worse..then convert it to a for loop and determine what the loop count should be based on therecser
size -
razor_ray over 8 years@TheEvilPenguin It goes through each result individually, so for example, if the first result in the search is NOT equal to the Active Document, then it will think that the document doesn't exist and hence will attempt to create the Document.
-
razor_ray over 8 years@MethodMan res is the name of the active document and resultRecord.Title is the name of the document in the EDRMS search results. If the value for both are not equal, thats when I want the new document to be created
-
MethodMan over 8 years@razor_ray I know that .. I am asking what is the actual value of both when you use the debugger... ...
-
-
razor_ray over 8 yearsthat is exactly what I needed Eric. Thanks for your help!