Solved [SOLVED] MySQL Won't start

Hello,

If I set the settings below to my /my.cnf file, MySQL doesn't start:
Code:
log-error=/var/log/mysql/mysqld.log
log_slow_queries = /var/log/mysql/mysql-slow.log

But when I comment them out, everything is back to normal. I really don't get why... could anyone help me understand?
root@FreeBSD:/ # vi /usr/local/my.cnf

Code:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# InnoDB one index file per table
innodb_file_per_table


# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

# Setting for utf8 encoding
character-set-server=utf8 # UTF-8
collation-server=utf8_general_ci # UTF-8
skip-character-set-client-handshake # UTF-8

#### MySQL Hardening ####

# Disable symlinks from database
skip-symbolic-links

# Disable unauthorized reading from local files
local-infile=0

# Enable logs in mysql server
#log-error=/var/log/mysqld.log
#log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 5

# Disable TCP networking
skip-networking

# Set non default port
port = 2913

# Stop database information gathering
skip-show-database

Thank you.
 
Re: MySQL Won't start

You can usually find the reason why something isn't working in the MySQL error log.
 
Re: MySQL Won't start

SirDice said:
You can usually find the reason why something isn't working in the MySQL error log.

This is the first place I looked but I cannot find any log file for MySQL.

root@kryten:/var/log # ls
Code:
auth.log                        messages.1.bz2
cron                            mount.today
cron.0.bz2                      pf.today
debug.log                       pf.yesterday
devd.log                        pflog
dmesg.today                     pflog.0.bz2
dmesg.yesterday                 pflog.1.bz2
fail2ban.log                    pflog.2.bz2
jail_mailjail_console.log       ppp.log
jail_sqljail_console.log        security
jail_webjail_console.log        sendmail.st
jail_www_console.log            sendmail.st.0
lpd-errs                        sendmail.st.1
maillog                         setuid.today
maillog.0.bz2                   userlog
maillog.1.bz2                   utx.lastlogin
maillog.2.bz2                   utx.log
messages                        xferlog
messages.0.bz2
 
Re: MySQL Won't start

I just realised I was looking in the wrong place for the log file.
Code:
[ERROR] /usr/local/libexec/mysqld: unknown variable 'log_slow_queries=/var/log/mysql/mysql-slow.log'
I am ooking into the issue now.
 
Re: MySQL Won't start

Ok I changed log_slow_queries for slow-query-log-file and that seems to work but I still cannot get
Code:
 log-error=/var/log/mysqld.log
to work. When
Code:
log-error=/var/log/mysqld.log
is enabled. no logs file or error message are created.
 
Re: MySQL Won't start

The @mysql user doesn't have permission to write in /var/log/.
 
Last edited by a moderator:
Re: MySQL Won't start

Ha ha ..
chown mysql:mysql mysql
resolved it.
Now should I set the permission to the log files to 600? What about the directory mysql.
 
Re: MySQL Won't start

fred974 said:
Now should I set the permission to the log files to 600? What about the directory mysql.
I'd leave the permissions as is. It should be set correctly when you installed MySQL and ran it for the first time. The first time you run it it creates the needed tables and sets the correct permissions on /var/db/mysql.
 
Back
Top