Cannot find my.cnf file

Hi,

I have just set up a new installation of MySQL 5.0.63. I am reading some tutorials on securing the installation. The tutorials are referring to a main config file called my.cnf which I am not able to find. I run # find / -name my.cnf; and nothing comes up. I have looked in the main installation directory  /usr/local/apache/mysql and nothing, as well as, in the /etc directory there is nothing.

Please help me with this issue in setting up the file in the correct place with the correct references.

Thank you!

D
designitmAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rindiCommented:
Normally it is in /etc/mysql/. How did you install MySQL? What distro? If you installed via your distro's package manager, the configuration would also have created that file, but if you installed some other way that isn't necessarily the case.
0
designitmAuthor Commented:
I installed it through source files and compiled it myself with these settings: ./configure --prefix=/usr/local/apache/mysql

The source files were obtained from mysql.com, for Linux, on a CentOs 5.+ system.

I had found the mysql.server script which I am now trying to set up as the service start up script when my systems boots. I am getting this error and "Starting MySQL. ERROR! Manager of pid-file quit without updating file." which I am not sure if it associates to my previous question or start a whole new one.

Thanks

D
0
rindiCommented:
I would install MySQL via yum, except if you need that particular version (I don't know which version is standard with CentOS). Then all your configuration files should get created automatically.
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

designitmAuthor Commented:
I had found the error problem. I had changed the mysql user from mysql to webmysql which gave errors. Now it is mysql and it runs, but I would like to change the mysql.pid file and place it in another location, as well as, finding the my.cnf file for setup?

Thanks,

D
0
designitmAuthor Commented:
I would do it with yum for simplicity, but then I am not learning how to install this properly from source.
0
rindiCommented:
You can always stop MySQL and then just delete the PID file if it doesn't remove itself (stopping the daemon will also normally delete the PID). The location of the PID file is defined in the my.cnf file. As mentioned before, the file should normally be inside etc/mysql.
0
designitmAuthor Commented:
I guess the problem is, how does the mysql server know to retrieve the my.cnf file, if I make it in the /etc/ directory?

Thanks,
D
0
rindiCommented:
If you want to find out lowlevel config details and info, then you should rather move from CentOS to Gentoo. Gentoo is a distro that compiles all apps from source, and it usually also includes the necessary how-to's and info about why etc. You will learn most that way.

http://gentoo.org
0
designitmAuthor Commented:
Thank you!

I will look into Gentoo. Would you know though how we tell the mysql server to use the my.cnf file?

Thanks D
0
UmeshSenior Principal Technical Support EngineerCommented:
For a binary distribution, look for the files in or under your installation directory. If you have a source distribution, look in the support-files directory. You can rename a copy of a sample file and place it in the appropriate location for use as a base configuration file. Regarding names and appropriate location, see the general information provided in

Filename                                      Purpose
/etc/my.cnf                                   Global options
SYSCONFDIR/my.cnf                   Global options
$MYSQL_HOME/my.cnf               Server-specific options
defaults-extra-file The file specified with --defaults-extra-file=path, if any
~/.my.cnf User-specific options

SYSCONFDIR represents the directory specified with the --sysconfdir option to configure when MySQL was built. By default, this is the etc directory located under the compiled-in installation directory. This location is used as of MySQL 5.0.21. (From 5.0.21 to 5.0.53, it was read last, after ~/.my.cnf.)



NO matter if you don't find such file then you can create your own file and place it under shown in above.. Typical option would be

Here is a typical global option file:

[client]
port=3306
socket=/tmp/mysql.sock

[mysqld]
port=3306
socket=/tmp/mysql.sock
key_buffer_size=16M
max_allowed_packet=8M

[mysqldump]
quick

The preceding option file uses var_name=value syntax for the lines that set the key_buffer_size and max_allowed_packet variables.

Here is a typical user option file:

[client]
# The following password will be sent to all standard MySQL clients
password="my_password"

[mysql]
no-auto-rehash
connect_timeout=2

[mysqlhotcopy]
interactive-timeout

To tell MySQL server to use optional file.. No need to tell this to mysql once its see the file is in standard location then it will use it.. bit still you want to know then below is the procedure



For example

mysqld_safe --defaults-file=/etc/my.cnf
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
designitmAuthor Commented:
Awesome!
0
designitmAuthor Commented:
Hey, I would like to know if you can help me one more time:

I have re-installed mysql with these setting on the CentOs system:

--- install mysql ---

      yum install ncurses-devel

      ./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql --localstatedir=/usr/local/mysql/data --with-unix-socket-path=/var/run/mysql.socket --with-openssl --with-vio
      
      --- install the default database information ---
      # /usr/local/mysql/bin/mysql_install_db
      
      --- transfer files and ensure permissions are the same as other service scripts in /etc/init.d/ directory ---
      # cp support-files/mysql.server /etc/init.d/mysql      

      --- create a user for this server that has limited access to any section but its own ---
      # groupadd mysql
      # useradd -d /usr/local/mysql/data -g mysql -c "MySQL Server Account" -c /bin/bash mysql
      # passwd mysql
      # tail -1 /etc/passwd
      # passwd -l mysql
      # usermod -s /bin/false mysql
      # grep mysql /etc/shadow
      # grep mysql /etc/passwd

# chown -R mysql DATADIR
# chgrp -R mysql DATADIR
# chmod -R go-rwx DATADIR



When starting the system with the mysql.server file I get

[root]# Connection to designitroom.com closed by remote host.

and an error file that looks like this:

081110 05:57:12  mysqld started
081110  5:57:12  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
081110 05:57:12  mysqld ended


Any ideas?

Thanks

D
0
UmeshSenior Principal Technical Support EngineerCommented:
It seems you posted this question already.,....

Clearly a permission issue..

perror 13
OS error code  13:  Permission denied

Try this..

#chown -R mysql:mysql /usr/local/mysql/data


It seems you granted the rights

# chown -R mysql DATADIR
# chgrp -R mysql DATADIR
# chmod -R go-rwx DATADIR


BTW wots DATADIR? and wots the results of

# ls -l /usr/local/mysql/data



Also, can you post InnoDB specific settings(full my.cnf would be fine) from my.cnf?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.