Cannot restart MySQL after editing my.cnf on Mac OS X 10.8.3

I am trying to enable logging on MySQL on my Mac, OS X version 10.8.3.

Wherever I searched, I get the same answer, i.e. add the following to my.cnf:

[mysqld] general_log=1 log=/var/log/mysql-query.log 

and then restart mysql.

The permissions on the log file are correct, and the owner is _mysql, like all other MySQL files.

However, it does not matter how much I try, once my.cnf has been changed, MySQL will not restart. It will be just a closure and that. Through the command line or through the settings panel, it will not start again.

I tried to enable log vie Workbench too, but as soon as log = ... the record goes to my.cnf, MySQL refuses to start. I need to manually delete this entry in order to start MySQL.

Can anyone help me on how to enable logging for MySQL on OS X 10.8.3?

+4
source share
3 answers

Well, finally spending more than a day, what worked for me is:

 general-log general_log_file = /var/log/mysql-query.log 

For almost 10 years on all Linux systems that I have ever used and installed, which should be at least 100, if not more, it has always been a simple entry, such as log = <path to the log file> in the [mysqld ]. Apparently, on the Mac, there was also what I read from various blogs, etc., however, in this particular setting that I do, this is the first time I set it up as shown above.

So my current working file /etc/my.cnf is as follows:

 [client] socket=/var/mysql/mysql.sock [mysqld] socket=/var/mysql/mysql.sock general-log general_log_file = /var/log/mysqld.log 

I had to do:

 touch /etc/my.cnf chown _mysql /etc/my.cnf 

to create it.

I also had to do:

 touch /var/log.mysqld.log chown _mysql /var/log/mysqld.log 

then restart mysql via Workbench. Also try restarting through the command line as follows:

 /usr/local/mysql/bin/mysqladmin -uroot -p shutdown sudo /usr/local/mysql/bin/mysqld_safe & 

The main thing, finally, it works, and I can move forward with my day.

+10
source

I am running MySQL Workbench 5.2.47 on a Mac Mountain Lion. The above steps (creating / etc / my.cnf, creating a dummy log file to populate mysql, etc.) can be performed in the MySQL Workbench.

1) Go to "Server Administrator" → "Settings File" ("Configuration"). 2) Set your parameters, including the location of the "general log" on the "Logging" tab. Click "Apply."
3) Startup / Shutdown → Stop Server 4) Start / Shutdown → Start Server Logging should now be enabled for all your applications.

0
source

@zeeshan's answer pointed me to the direction of the recording, the most important thing is to make sure the rights are correct, as zeehan said.

/etc/my.cnf

 [mysqld] general_log = 1 general_log_file = /var/log/mysql-query.log 

Then simply run the log files and my.cnf that will belong to "_mysql".

sudo chown _mysql /var/log/mysql-query.log sudo chown _mysql /etc/my.cnf

Should restart mysqld using system_preferences.

0
source

Source: https://habr.com/ru/post/1486209/


All Articles