Mysql configuration for an especific site

Discussion in 'General' started by calbasi, Dec 17, 2018.

Tags:
  1. calbasi

    calbasi Member

    Hi,
    I wonder if it's possible set mysql config options (my.cnf) just for one of my sites.
    Could I use ~/.my.cnf ?
    Then, which is the user who run mysql on ISPConfig? client1, client2, etc?
    I think there is no user/home folder, is there?
     
  2. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    No, not for the website.
    It would usually be the "web" users, web1, web2, etc. (assuming you have suexec enabled, which is almost always the case).
    None that the web server would use.

    The mysql client for a website is most frequently the php interpreter in ispconfig setups, and php normally runs as the web# user. There are custom php directives you can set for a website, see the config options for the specific mysql driver your application uses (eg. mysqli .. http://php.net/manual/en/set.mysqlinfo.php).

    If you happen to run a non-php site, you would similarly have to identify what interpreter/module/etc. handles the website, and look up how to configure it.
     
    till likes this.
  3. gec

    gec Member

    Sorry for bringing this old question from the dead, but i have the same problem and not enough knowledge.
    i've read the Jesseis comment, and checked the link, but i do not understand it.
    i have few mysql settings that i need to make for specific site only: lower_case_table_names=2, old-passwords and max_allowed_packet=64M.

    How exactly do I do that?
    thx
     
  4. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    lower_case_table_names and max_allowed_packet are globals, just set them in your main my.cnf config. old_passwords looks like a setting you use prior to creating a user, and there is nothing in ispconfig to tell it to set that prior to creating a database user, so you would have to do that manually (or add a checkbox to the database user screen for this setting and modify the server plugin to use it - I suspect not worth the effort, but who knows).
     
    gec likes this.
  5. gec

    gec Member

    ok. i've put lower_case_table_names and max_allowed_packet in /etc/mysql/my.cnf and restarted mysql server, but i still get same errors related to case in SELECT statemens. Is that right location of the my.cnf?
     
  6. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    what does your my.cnf look like, and what is the error you get?
     
  7. gec

    gec Member

    Code:
    # The MariaDB configuration file
    #
    # The MariaDB/MySQL tools read configuration files in the following order:
    # 0. "/etc/mysql/my.cnf" symlinks to this file, reason why all the rest is read.
    # 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
    # 2. "/etc/mysql/conf.d/*.cnf" to set global options.
    # 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
    # 4. "~/.my.cnf" to set user-specific options.
    #
    # If the same option is defined multiple times, the last one will apply.
    #
    # One can use all long options that the program supports.
    # Run program with --help to get a list of available options and with
    # --print-defaults to see which it would actually understand and use.
    #
    # If you are new to MariaDB, check out https://mariadb.com/kb/en/basic-mariadb-articles/
    
    #
    # This group is read both by the client and the server
    # use it for options that affect everything
    #
    [client-server]
    # Port or socket location where to connect
    # port = 3306
    socket = /run/mysqld/mysqld.sock
    
    # Import all .cnf files from configuration directory
    !includedir /etc/mysql/conf.d/
    !includedir /etc/mysql/mariadb.conf.d/
    
    [mysql]
    # Local extensions for SEOW
    lower_case_table_names=2
    
    #extend query chunk size to something sensible
    max_allowed_packet=128M 
    after the update.
    errors luck like this:
    Code:
    Notice: Trying to get property of non-object in /var/www/clients/client2/web18/web/MP4public/Scripts/MP-Connection.php on line 59
    
    Notice: Trying to get property of non-object in /var/www/clients/client2/web18/web/MP4public/Scripts/MP-Connection.php on line 62
    
    Notice: Trying to get property of non-object in /var/www/clients/client2/web18/web/MP4public/Scripts/MP-Connection.php on line 63
    
    Notice: Trying to get property of non-object in /var/www/clients/client2/web18/web/MP4public/Scripts/MP-Connection.php on line 64
    
    Fatal error: Call to a member function MoveNext() on boolean in /var/www/clients/client2/web18/web/MP4public/Scripts/MP-Connection.php on line 66
    if i open that file and change the SELECT statement to lovercase this errors disappear but new ones come from other files.
    I could go through all the files and change everything to lovercase, but that would be tedious
     
  8. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    server settings need to be in the 'mysqld' section, not 'mysql'.
     
  9. gec

    gec Member

    here's how my my.cnf looks now:
    Code:
    # The MariaDB configuration file
    #
    # The MariaDB/MySQL tools read configuration files in the following order:
    # 0. "/etc/mysql/my.cnf" symlinks to this file, reason why all the rest is read.
    # 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
    # 2. "/etc/mysql/conf.d/*.cnf" to set global options.
    # 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
    # 4. "~/.my.cnf" to set user-specific options.
    #
    # If the same option is defined multiple times, the last one will apply.
    #
    # One can use all long options that the program supports.
    # Run program with --help to get a list of available options and with
    # --print-defaults to see which it would actually understand and use.
    #
    # If you are new to MariaDB, check out https://mariadb.com/kb/en/basic-mariadb-articles/
    
    #
    # This group is read both by the client and the server
    # use it for options that affect everything
    #
    [client-server]
    # Port or socket location where to connect
    # port = 3306
    socket = /run/mysqld/mysqld.sock
    
    # Import all .cnf files from configuration directory
    !includedir /etc/mysql/conf.d/
    !includedir /etc/mysql/mariadb.conf.d/
    
    [mysqld]
    # Local extensions for SEOW
    lower_case_table_names=2
    
    #extend query chunk size to something sensible
    max_allowed_packet=128M 
    i've restarted mysql server with systemctl restart mariadb
    but still no fix
     
  10. gec

    gec Member

  11. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    Try setting lower_case_table_names in a 'mariadb' section (per the docs).
     
  12. gec

    gec Member

    not working also. but...
    in the same docs
    so my guess is - this is not going to work
     
  13. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    Maybe it would be easier to just rename the tables to match what your app is using?
     
    gec likes this.
  14. gec

    gec Member

    that would be one solution. or install db on some windows machine
     
  15. gec

    gec Member

    please excuse my french but *** me i think i got it working! after setting lower_case_table_names i had to reimport the databases and they where imported case sensitive.

    of course this totally contradicts the line from the mariadb docs

    pls don't ban me for my french, but did not know better way to show my relief
    and sorry @calbasi for totally hijacking the thread at the end

    thx @Jesse Norell for the support!!
     
    Last edited: Feb 12, 2022
    Th0m likes this.

Share This Page