mysqld ignoring my.cnf (mysql 5.6 on Ubuntu 16.04 Server) - mysql

I installed mysql 5.6 on Ubuntu Server 16.04 using this method: https://askubuntu.com/questions/762384/install-mysql-5-6-on-ubuntu-16-04
But i'm having trouble getting mysqld to read /etc/mysql/my.cnf
Specifically i'm trying to set it up for an Atlassian Confluence installation where I have to add in these settings:
[mysqld]
character-set-server=utf8
collation-server=utf8_bin
default-storage-engine=INNODB
max_allowed_packet=256M
innodb_log_file_size=2G
I've checked mysqld --help --verbose and it has the my.cnf in its path. Here's the relevant output:
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf The following
groups are read: mysqld server mysqld-5.6
I know that mysql is reading the file because if I change [mysqld] to [mysql] the arguments are correctly printed when I run mysql --print-defaults also if I put a wrong line in the file mysql will fail to start and tell me where the syntax error is. However mysqld does not report any arguments for mysqld --print-defaults or tell me about syntax errors in the file.
What else can I try?
Solved:
my.cnf was a symbolic link. I deleted it and made it an actual file. Now mysqld --show-defaults is working! So apparently mysql will follow the symlink but mysqld will not. Good to know.

my.cnf was a symbolic link. I deleted it and made it an actual file. Now mysqld --show-defaults is working. So apparently mysql will follow the symlink but mysqld will not.

For mysqld as I know only hard links works. Or maybe you just had wrong permission, on original my.cnf file to which you put symbolic link.

Related

Found option without preceding group in config file /etc/my.cnf at line 1

I haven't found anything online that's helped me address this error. I had to uninstall mysql, and I used this guide to uninstall. Then I reinstalled it. I got this error:
mysqld: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1.
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
So I uninstalled again, and attempted to uninstall the my.cnf file as well. After reinstalling a second time, I opened my.cnf and my.cnf.default files and [mysqld] is at the very top, with nothing (no comments or space) above it. I also checked to make sure that the files are in UTF-8. I still get this error when running brew postinstall mysql.
Here's what my.cnf file looks like, I moved the comments to the bottom to see if it would fix it:
[mysqld]
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1
# Default Homebrew MySQL server config
# Only allow connections from localhost
If anyone has any insight that would be greatly appreciated. I'm running MacOS Big Sur.

MariaDB configuration changes don't take effect

The server is working on CentOS 8, I'm trying to configure MariaDB by making alterations to /etc/my.cnf but then when I restart DB by doing sudo systemctl restart mariadb, the server does restart but no configuration changes get applied.
mysql > SHOW VARIABLES;
It outputs the same values. I tried to comment out the including directive #!includedir /etc/my.cnf.d and to add settings to [mysqld] and [mariadb] sections.
mysql --verbose --help says:
Default options are read from the following files in the given order:
/etc/my.cnf ~/.my.cnf.
The following groups are read: mysql client client-server client-mariadb
Check whether mysql uses the config file debugging it with strace:
sudo strace mysql
In the strace output, look for lines like:
openat(AT_FDCWD, "/etc/my.cnf", O_RDONLY|O_CLOEXEC) = ...
Make sure openat doesn't return -1. In that case check whether the file exists or mysql has enough permissions to read the file.
When adding additional configuration files, make sure that they are not writable by 'other'. Otherwise you'll have a message on mysql startup like:
Warning: World-writable config file '/etc/mysql/conf.d/myproject.cnf' is ignored
and the configuration does not get applied.

MySQL Not Working [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have an amazon ec2 instance running on the Amazon Linux AMI and its a micro instance. I wanted to install Django onto my server so I entered these commands
wget http://www.mlsite.net/blog/wp-content/uploads/2008/11/go
wget http://www.mlsite.net/blog/wp-content/uploads/2008/11/django.conf
chmod 744 go
./go
So after I was done, I ran sudo service httpd restart and sudo service mysqld restart
and This is what came up for mysqld:
Stopping mysqld: [ OK ]
MySQL Daemon failed to start.
Starting mysqld: [FAILED]
So I deleted the django files /usr/local/python2.6.8/site-packages/django_registration.egg
and I tried finding the error and I found out that in my
/etc/my.cnf for the socket, it said
[mysqld]
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
datadir=/mnt/ebs/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysqld]
default-storage-engine=INNODB
[mysqld]
default-storage-engine=INNODB
[mysqld]
default-storage-engine=INNODB
[mysqld]
default-storage-engine=INNODB
so I went to /var/lock/subsys/ and there was no mysql.sock. I tried creating one using vim but it still didn't work. Then I checked the error log and it said
120712 20:33:11 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
120712 20:33:15 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
UPDATE:
I entered these commands:
cd /var/lib/mysql/
touch mysql.sock
chmod +x mysql.sock
chown mysql:mysql -R *
And it still didn't work...
So I am pretty much lost right now. I know it has something to do with mysql.sock
If you might know a reason why this was caused could you please let me know? I have a wordpress site on my server, so i kind of need MySQL to work. Thanks!
Inspecting the go script you downloaded and executed, I found the following lines:
# Change the MySQL data directory
sed -e 's!/var/lib/mysql$!/mnt/ebs/mysql!' -i /etc/my.cnf
This effectively changes your mysql data directory (datadir setting), so you can't access any previously created database (like the wordpress database).
As a wild guess, I would think that the mysqld can't access /mnt/ebs/mysql and therefore doesn't start. Try to change it back to /var/lib/mysql. However, this might interfere with your django. If you get the django configured mysql to run, you can always add a second my.cnf with another name and other tcp port and run two MySQL servers with different configurations.
The socket error message is about the MySQL server not running. Do not try to emulate the socket by putting a file in its way.
The go script also makes some more changes to my.cnf that could be a problem. Have a look at the go file yourself and try to undo the changes made.
If nothing of the above helps, you can try to start the mysqld process from command line by hand, using the same arguments as the service script does, plus an added --verbose and post its output.
Ok, I figured it out thanks to #escitalopram so I will accept his answer! Ok, django changed my MySQL data directory from /var/lib/mysql to /mnt/ebs/mysql in my /etc/my.cnf, so in my /etc/my.cnf, it said
datadir=/mnt/ebs/mysql and I changed it to datadir=/var/lib/mysql. And everything worked fine. I restarted MySQL hoping for the red [FAILED] message but I got an [OK]. Also, my socket was messed up in /etc/my.cnf but I had already fixed that!

try to change bin log directory: mysql-bin.index not found (Errcode: 13)

MySQL 5.1.54
Ubuntu 11.04
I'am try to change bin log directory in my.conf as:
[mysqld]
log_bin=/home/developer/logs/mysql/mysql-bin.log
After this changes MySQL server can't start with error:
/usr/sbin/mysqld: File '/home/developer/logs/mysql/mysql-bin.index'
not found (Errcode: 13)
111005 12:47:58 [ERROR] Aborting
Permission for directory /home/developer/logs/mysql/ is 0777
What's going on?
As usual, the solution was simple but not obvious: it needed to edit apparmor settings
I just added to /etc/apparmor.d/usr.sbin.mysqld a new string with path to target directory: /home/developer/logs/* rw
It works!
/usr/sbin/mysqld: File '/usr/binlogs/mysql-bin.index' not found
(Errcode: 13)
It worked for me with:
chown -R mysql:mysql /usr/binlogs/
Just as an FYI for anyone who runs into a similar problem, the solution is basically the same, but the cause of the problem isn't obvious.
After upgrading Debian wheezy, mysql failed to start.
Somehow, I have no idea how, permissions on some of the files in /var/lib/mysql were not owned by the mysql user, thus preventing the server from firing up.
A chown -R mysql.mysql /var/lib/mysql fixed it.
I didn't do anything to mess up mysql, it was a standard:
apt-get update
apt-get upgrade
Something got hinky during the Debian upgrade and manual intervention was needed.
Selinux might enforce the rule that MySQL database files have to live in /var/lib/mysql and not anywhere else. Try turning off selinux (selinux=0 on kernel boot command line) if you moved mysql to another directory.
Option 1:
service mysqld stop
Copy the log files including the .index file to new location.
cp mysql-bin.log* /path/to/binlogs
cp mysql-bin.index /path/to/binlogs
Do Changes in the /etc/my.cnf file.
[mysqld]
log-bin=/path/to/newdirecory/mysql-bin
log-bin-index=/path/to/newdirectory/mysql-bin.index
service mysqld start
Option 2:
Use this utiltiy to relocate binary logs:
mysqlbinlogmove --binlog-dir=/server/data /new/binlog_dir
You need to give user permissions to the directory as follows:
chown -R mysql:mysql /home/developer/logs/mysql/
Does your user have access to all upper directories? In special, the /home/developer/ directory? Try to log in with the mysql server account and touch the log file.
mysqld: File '/data/log/mysql/mysql-bin.index' not found (Errcode: 2
- No such file or directory)
I was really stuck in the middle of my MySQL Master - Slave setup. Finally the above was a permission issue, adding the below command solved my issue.
chown -R mysql:mysql /data/log/mysql/
I had a similar problem when I was trying to change the datadir variable during a fresh install. The solution in my case was to run the first time start up with log-bin disabled. After that I was able to enable it again using the new path ...
Your config is wrong:
log_bin=/home/developer/logs/mysql/mysql-bin.log
You would use instead
log-bin=/home/developer/logs/mysql/mysql-bin.log
During replication configuration in "my.cnf" file needs to mention
server-id=1
log_bin=/var/log/mysql/mysql-bin.log
you can make your own directory and give permission.
create directory "mysql" in /var/log/
chmod 777 mysql
this is applicable with MySQL version 5.7
You can also comment the line in my.cnf file which is defining the log location, so mysql will consider its default path and will start properly.
log-bin = /var/log/mysql/mysql-bin.log -> #log-bin = /var/log/mysql/mysql-bin.log.
This will be helpful if you are not concerned much about logs.
As documentation in mysql say https://dev.mysql.com/doc/refman/5.7/en/replication-options-binary-log.html#sysvar_log_bin
The variable is log_bin and not log-bin at least in version 5.7

Does MySQL included with MAMP not include a config file?

I can't seem to find the my.cnf or other config file for the MySQL that comes with MAMP. Does it not include one?
The MySQL server of MAMP (not PRO) will be started without any my.cnf file. But you can create your own my.cnf file.
Stop servers
Create a my.cnf file in /Applications/MAMP/conf/
Add your content in to my.cnf
Save my.cnf
Start servers
You do not have to put a complete configuration in the my.cnf file. You can just add parts of a configuration ... for example:
[mysqld]
max_allowed_packet = 64M
Some standard my.cnf variants can be found at /Applications/MAMP/Library/support-files/
Invoking mysqld --verbose --help | less on the MAMP mysqld binary reports:
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /Applications/MAMP/conf/my.cnf ~/.my.cnf
Copy one of the variants in /Applications/MAMP/Library/support-files/ to one of the locations in mysqld's search order above, and you should be good to go after restarting the daemon.
Since MAMP server generates my.cnf dynamically on MAMP server startup, it's best to use the following steps to add or edit the MySQL configuration:
Stop MAMP server
Goto Files > Edit Template > MySQL
Make the necessary changes and save
Restart MAMP
I tried this on MAMP PRO 3.5.
For MAMP 3.5 on Mac El Capitan, only this worked for me:
Stop servers
Create a my.cnf file in /Applications/MAMP/Library/
Add your content into my.cnf like
[mysqld]
max_allowed_packet = 64M
Save my.cnf
Start servers
Not required to change ownership of file, it should work. Verify by running SHOW VARIABLES in phpmyadmin and look for your changed setting.
No, it doesn't come with the my.cnf file
I found that MAMP PRO will create a my.cnf by default on startup under the MAMP/tmp directory if a ~/my.cnf is not provided ... grepping ps aux you may find the default location under /Applications/MAMP/tmp/my.cnf ...
ps aux | grep mysql
Which provided the following...
root 284 0.0 0.1 2435544 532 ?? Ss 12:00AM 0:00.06 /bin/sh /Applications/MAMP/Library/bin/mysqld_safe
--defaults-file=/Applications/MAMP/tmp/mysql/my.cnf
--port=8889 --socket=/Applications/MAMP/tmp/mysql/mysql.sock
--user=mysql --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid
--log-error=/Applications/MAMP/logs/mysql_error_log.err
--tmpdir=/Applications/MAMP/tmp/mysql/tmpdir
--datadir=/Library/Application Support/appsolute/MAMP PRO/db/mysql