Mysql Error Log Permissions
Contents |
Quotes Presentations Experience 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 You are here: Home / Technologies / Databases / Monitoring MySQL - The error logMonitoring MySQL - The error log September var log mysqld log permission denied 16, 2009 by ronald It is important that you monitor the MySQL error chmod: changing permissions of ‘/var/lib/mysql’: operation not permitted log. There are a few different options available for defining the details of the log. If not specified the
/var/log/mysql/error.log Permission Denied
default is [datadir]/[hostname].err. This is not an ideal location for 2 reasons. First, a correctly configured MySQL datadir will have permissions only for the mysql user, and this is generally restrictive
Touch: Cannot Touch `/var/lock/subsys/mysqld': Permission Denied
access to the user only and no group or world permissions. Other users/groups should have limited access to the mysql error log. Second, the datadir is for data, not logs, especially logs that can potentially fill file systems. I am referring here to more then just the error log. I would recommend you create a separate directory for MySQL logs such as the error, mysql log level slow and general logs. An example I implement for single installation environments using Linux mysql packages is: mkdir /var/log/mysql chown mysql:mysql /var/log/mysql chmod 750 /var/log/mysql There does not seem to be a consensus over whether to include the hostname or not in the error log filename. My preference is to not include. I would rather the filename to be consistent across multiple servers. The argument is what about when consolidating logs from multiple servers. I discount this because you have to connect to the server to retrieve logs, create a sub directory of that hostname for consolidated logs. With Linux distributions you may not find log files where you expect. Ubuntu packages for example has the log going to syslog. While the theory is to make system logging and monitoring easier, it makes MySQL specific monitoring more difficult. You also suffer a logrotate problem where you may only have 7 days of log. I prefer to have access to all historical MySQL log information. The best choice is to define the error log with log-error, in both the [mysqld_safe] and [mysqld] section of your servers my.cnf [mysqld_safe] log-error=/var/log/mysql/error.log
Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the
Not Found (errcode: 13 - Permission Denied)
company Business Learn more about hiring developers or posting ads with us Server Fault Questions mysql enable general log Tags Users Badges Unanswered Ask Question _ Server Fault is a question and answer site for system and network administrators. Join them; mysqld_safe permission denied it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top General logging won't work in MySQL up http://ronaldbradford.com/blog/monitoring-mysql-the-error-log-2009-09-16/ vote 2 down vote favorite 2 I saw on SF that there's an option in MySQL to log all queries. So, in my version (mysql-server-5.0.45-7.el5 on CentOS 5.2) this appears to be a case of enabling the 'log' option, so I edited /etc/my.cnf to add this: [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql old_passwords= log=/var/log/mysql-general.log [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid I then created the file and set permissions: # touch /var/log/mysql-general.log # chown mysql. /var/log/mysql-general.log # ls -l /var/log/mysql-general.log -rw-r--r-- http://serverfault.com/questions/351062/general-logging-wont-work-in-mysql 1 mysql mysql 0 Jan 18 15:22 /var/log/mysql-general.log But when I start mysqld I get: 120118 15:24:18 mysqld started ^G/usr/libexec/mysqld: File '/var/log/mysql-general.log' not found (Errcode: 13) 120118 15:24:18 [ERROR] Could not use /var/log/mysql-general.log for logging (error 13). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it. 120118 15:24:18 InnoDB: Started; log sequence number 0 182917764 120118 15:24:18 [Note] /usr/libexec/mysqld: ready for connections. Can anyone suggest why this isn't working? mysql share|improve this question asked Jan 18 '12 at 14:28 leonstr 2814 happen to use centos/redhat with selinux is enabled? –Mike Jan 18 '12 at 15:30 add a comment| 5 Answers 5 active oldest votes up vote 4 down vote accepted "Not found" sounds like a permission problem, even though you have given mysql permission to touch that specific file, it might not have access to /var/log. Try putting the log file in the mysql data folder, /var/lib/mysql/. I am trying to remember a case of ever seeing the mysql log files outside of that path.. share|improve this answer answered Jan 18 '12 at 15:18 Tim 2,323813 If I can remember correctly that is the problem - mysql needs read access to the directory housing the log file itself. &nda
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company http://stackoverflow.com/questions/29004285/cannot-touch-var-log-mysqld-log-permission-denied Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs http://forums.mysql.com/read.php?10,373343,373343 Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up cannot touch `/var/log/mysqld.log': Permission denied up vote 1 down vote favorite i have reinstalled mysql server in cent OS RHEL5.5 , Im permission denied getting the following error touch: cannot touch `/var/log/mysqld.log': Permission denied chown: changing ownership of `/var/log/mysqld.log': Operation not permitted chmod: changing permissions of `/var/log/mysqld.log': Operation not permitted MySQL Daemon failed to start. Starting mysqld: [FAILED] I have checked the permissions for log files , its having correct permissions as mysql user -rw-r----- 1 mysql mysql 5931 Mar 9 04:36 mysqld.log Please let me know the issue on this and how to solve it. Thanks mysql log permission denied logging centos permission-denied share|improve this question edited Mar 12 '15 at 7:46 asked Mar 12 '15 at 7:43 forbidden 614 you are running mysql with user mysql? which permissions has the directory /var/log? –Jens Mar 12 '15 at 7:46 try using chmod 660 mysqld.log once, using root permissions –Anshul Mar 12 '15 at 7:58 chmod: changing permissions of `/var/log/mysqld.log': Operation not permitted –forbidden Mar 12 '15 at 8:11 no as root user @Jens –forbidden Mar 12 '15 at 8:21 What is the output of whoami? –EternalHour Mar 12 '15 at 8:42 | show 1 more comment 2 Answers 2 active oldest votes up vote 1 down vote The workaround is: $ sudo touch /var/log/mysqld.log $ sudo chown mysql:mysql /var/log/mysqld.log $ sudo chcon system_u:object_r:mysqld_log_t:s0 /var/log/mysqld.log share|improve this answer edited Oct 28 '15 at 14:34 T3 H40 1,36761224 answered Oct 28 '15 at 13:40 Pruthvi Kumar 512 add a comment| up vote 0 down vote accepted Ok. I have solved the issue, $ /usr/libexec/mysqld --skip-grant & [1] 5388 InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes InnoDB: than specified in the .cnf file 0 5242880 bytes! 150312 10:03:28 [Note] /usr/libexec/mysqld: ready for connections. Version: '5.0.95' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution $ rm -rf /var/lib/mysql/ib_logfile0 $ rm -rf /var
Community Podcasts MySQL.com Downloads Documentation Section Menu: MySQL Forums :: Newbie :: MySQL keeps changing the permissions for mysqld.log New Topic Advanced Search MySQL keeps changing the permissions for mysqld.log Posted by: John Riverbank () Date: June 24, 2010 12:41PM Using MySQL 5.0 on RedHat 5.3 I've been playing with the MySQL configuration to get it to work with my application. By default I don't have permission to read it, so I've been going to my sysadmin to grant me permission each time I need to see it. The trouble is that every time I restart the server, I lose my read permissions for my.cnf (Immediately before starting: rw--r--r--, After: rw-r-----) Is there a way to stop MySQL from doing this? Does anyone know of a workaround? My next step is to ask my sysadmin to give my sudo access to the log file. Or, to post my my.cnf file here and hope I get lucky with some genius insight from you all. Any help or suggestions are appreciated. Thanks, John Navigate:Previous Message•Next Message Options:Reply•Quote Subject Written By Posted MySQL keeps changing the permissions for mysqld.log John Riverbank 06/24/2010 12:41PM Re: MySQL keeps changing the permissions for mysqld.log Shawn Taylor 06/24/2010 12:56PM Re: MySQL keeps changing the permissions for mysqld.log John Riverbank 06/24/2010 01:20PM Re: MySQL keeps changing the permissions for mysqld.log Shawn Taylor 06/24/2010 02:06PM Re: MySQL keeps changing the permissions for mysqld.log John Riverbank 06/29/2010 12:56PM Sorry, you can't reply to this topic. It has been closed. powered by phorum Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party. Contact Sales USA: +1-866-221-0634 Canada: +1-866-221-0634 Germany: +49 89 143 01280 France: +33 1 57 60 83 57 Italy: +39 02 249 59 120 UK: +44 207 553 8447 Japan: 0120-065556 China: 10800-811-0823 India: 0008001005870 More Countries» Contact Us Online» Products MySQL Enterprise Edition MySQL Standard Edition MySQL Classic Edition MySQL Cluster CGE MySQL Embedded (OEM/ISV) Services Training Certification Consulting Support Downloads MySQL