The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Where is mysql.conf?

Discussion in 'General Discussion' started by NetBloke, Jan 11, 2007.

  1. NetBloke

    NetBloke Member

    Joined:
    Mar 18, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Seattle, Washington, USA
    I am looking to edit some of the global variables in my mysql setup.

    I believe I am looking for mysql.conf (tell me if I am wrong) to do so. However I do not know where to look for this file.

    Thanks!
     
    #1 NetBloke, Jan 11, 2007
    Last edited: Jan 11, 2007
  2. sawbuck

    sawbuck Well-Known Member

    Joined:
    Jan 18, 2004
    Messages:
    1,367
    Likes Received:
    5
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Try /etc/my.cnf
     
  3. NetBloke

    NetBloke Member

    Joined:
    Mar 18, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Seattle, Washington, USA
    thanks but that wasnt it either.

    Still searching....
     
  4. nwilkens

    nwilkens Well-Known Member

    Joined:
    May 4, 2006
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Monroe MI
    cPanel Access Level:
    DataCenter Provider
    MySQL

    Default options are read from the following files in the given order:
    /etc/my.cnf /var/lib/mysql/my.cnf ~/.my.cnf

    usually.. ;)

    or try 'locate my.cnf' or 'find / -name my.cnf'
     
  5. dafut

    dafut Well-Known Member

    Joined:
    Dec 14, 2005
    Messages:
    75
    Likes Received:
    0
    Trophy Points:
    6
    The hidden ~/.my.cnf file contains user specific info, such as username/password so that you don't need to type it in when using mysql or mysqladmin from the command line.

    The other my.cnf files are either global or specific to a database depending on their location.

    mySQL loads with default variables that can be overridden by use of a my.cnf file. Either at root command line or in phpMyAdmin, you can see the current variables.
     
  6. NetBloke

    NetBloke Member

    Joined:
    Mar 18, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Seattle, Washington, USA
    thanks for the answers...

    Dan I imagine I have to run a piece of code to switch the variable setting, as the my.cnf file seems to only have a couple of lines of code rather than a list of variables and their settings.

    I did know how to see the settings in phpmyadmin, it is just changing them that I am having a problem doing.
     
  7. dafut

    dafut Well-Known Member

    Joined:
    Dec 14, 2005
    Messages:
    75
    Likes Received:
    0
    Trophy Points:
    6
    You can manually edit the file. A variable can also be "injected" into a running mysql service.

    Something like this:

    Log into mysql in SSH as root.

    then perform the following:
    > show variables;
    > set global key_buffer_size=12000000;

    The "show variables;" command will give you a list of the variables similar to what you see in phpMyAdmin.

    That particular "set" will inject/insert the global key_buffer_size variable to 12M. Different variables can be done the same way, using the variable name seen in the "show variables" list.

    This is good for making on the fly changes. Just remember that these changes will be lost when mysql reloads.

    What may help a lot, NetBloke, are the sample *.cnf files @ /usr/share/mysql/ . In that directory, you'll find my-small.cnf, my-medium.cnf and other .cnf files. Look at them for ideas on different configurations. On one of my servers, I used my-medium.cnf and modified it slightly for that server. (Always backup your original /etc/my.cnf file). Simply copy the .cnf file you want to work with from that location to /etc/ and change its name to my.cnf.

    Restart mysql and check for errors and proper operation. Be very cautious about using anything larger than the my-medium.cnf as your base...the larger .cnf files are for dedicated mysql servers and not designed for a server that's delivering web and other services.

    In many cases, the my-small.cnf will fill most needs. A google for "mysql tuning optimization" might also be a good idea.

    Probably way more info than you wanted; hope it helps.
     
  8. NetBloke

    NetBloke Member

    Joined:
    Mar 18, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Seattle, Washington, USA
    No that is fantastic dafut! I will try it out and see how it goes!
     
Loading...

Share This Page