Bugzilla – Bug 155341
possible mysql package changes: log & db placement, .my.cnf in /etc/skel, compleetion.
Last modified: 2007-02-06 13:32:55 UTC
Almost anybody using mysql 'll set roots password. So, why not to put somthibg similar to the following into /etc/skel as .my.cnf: ========cut============== ----------------- [ 06:31:12, root@skylab, /usr/src/2Install/CURRENT/ZoneMinder-1.22.0 ] # cat ~/.my.cnf # # If root password is set, this file is required to be presend for root # WITH PASSWORD for automated logrotating. See /etc/logrotate.d/mysql # [mysqladmin] #password = <yourpasshere> #user= <defaultuser> port = 3306 socket = /default/path/to/socket/mysql.sock # set default encoding. #default-character-set=<yourencodinghere> ----------------- [ 06:31:18, root@skylab, /usr/src/2Install/CURRENT/ZoneMinder-1.22.0 ] # ========cut============== Also I'm curiouse - why not to put all logs to /var/log ? By default logs are going to /var/lib... Why not to /var/log/mysql/* ? ?-)
See also bug #152139 - w/ secure permissions /etc/my.cnf is not usable for ordinary users.
Olli, please address only one problem in each report you write. Reassigning to Michal for a comment.
I could put a symlink /var/log/mysqld.log -> ../lib/mysql/mysqld.log, but looking at this, I found that mysql-5.0 removed the --err-log option in favour of --log-error, which breaks with existing my.cnf files :-/
http://bugs.mysql.com/bug.php?id=14319
(In reply to comment #0) > Almost anybody using mysql 'll set roots password. So, why not to put somthibg > similar to the following into /etc/skel as .my.cnf: > > ========cut============== > ----------------- [ 06:31:12, root@skylab, > /usr/src/2Install/CURRENT/ZoneMinder-1.22.0 ] > # cat ~/.my.cnf > # > # If root password is set, this file is required to be presend for root > # WITH PASSWORD for automated logrotating. See /etc/logrotate.d/mysql > # > [mysqladmin] > #password = <yourpasshere> > #user= <defaultuser> To see the comments, you need to have opened /root/.my.cnf, which means you at least know what file to edit. I would instead echo some explanation in the logrotate scrip (which the administrator would get via email). What do you think?
(In reply to comment #3) > I could put a symlink /var/log/mysqld.log -> ../lib/mysql/mysqld.log, > but looking at this, I found that mysql-5.0 removed the --err-log option in > favour of --log-error, which breaks with existing my.cnf files :-/ Generally having symlink is currently useless for me. I've found the subject of report while checking does my sql db and its logs sit on secure place or not. I'm playing with system that is configured in such a way, when everything including logs is on an encrypted filesystems. The swap is also encrypted. Though, since I some times need my PC to be up after power crash I'm not putting the entire system on encrypted fs. So, the best for me is that all logs are stored under one place (in related subdirs if needed). I've moved logs to /var/log/mysql/* and db also moved. The better place for the DB is /srv instead, IMO. Having that it's easier to get less modifications to default configuration.. I'm about that encrypting entire /var/lib may give wrong results for boots w/o human presence at console. Well, encrypting the only /var/lib/mysql is also a possibility.. thus a symlink would be OK. (In reply to comment #5) > (In reply to comment #0) > > # cat ~/.my.cnf > > # > > # If root password is set, this file is required to be presend for root > > # WITH PASSWORD for automated logrotating. See /etc/logrotate.d/mysql > > # > > [mysqladmin] > > #password = <yourpasshere> > > #user= <defaultuser> > To see the comments, you need to have opened /root/.my.cnf, which means you at > least know what file to edit. I would instead echo some explanation in the > logrotate scrip (which the administrator would get via email). What do you > think? That's also OK. Anyway, if a system gets configured with care - the stuff in /etc/skel is one of things that I'd examine. (In reply to comment #4) > http://bugs.mysql.com/bug.php?id=14319 Yes. That works definitely that way: =========cut========= ----------------- [ 02:09:45, root@skylab, ~ ] # grep ^datadir /etc/init.d/mysql datadir=/var/spool/mysql ----------------- [ 02:10:06, root@skylab, ~ ] # export `grep ^datadir /etc/init.d/mysql` ----------------- [ 02:10:18, root@skylab, ~ ] # ls $datadir . ib_logfile1 mysql.sock skylab-bin.000004 zm .. mysql skylab-bin.000001 skylab-bin.index ibdata1 mysqld.log skylab-bin.000002 skylab.digger.org.ru.err ib_logfile0 mysqld.log.1.gz skylab-bin.000003 update-stamp-4.1 ----------------- [ 02:10:24, root@skylab, ~ ] # grep /var/log /etc/my.cnf err-log=/var/log/mysql/mysqld.log =========cut========= BTW: The logs are pain here.. I wish to see at least general events such as server reload and got signal(s) in /var/log/messages in general.. Or at least in /var/log/all (made as putting in syslog.conf string "*.* /var/log/all").. And can I've text logs with the binary ones at once? I've enabled binary logging & seems 've now to smoke some documentation :) to get a clue how to get info from there. %)) Well, that's not a right place to ask.. ignore. Also I've moved socket to /var/run/ .. (In reply to comment #2) > Olli, please address only one problem in each report you write. > Reassigning to Michal for a comment. oh.. sorry, but if I'll - most of my reports will get invalid. Since some of questions may arrive not a bug or get a 'wontfix'.. And some times I'm not sure is that a bug or a feature.. ;)
Heh, had to get socket back to /var/lib/mysql/mysql.sock since perl DBI doesn't care on /etc/my.cnf & ~/.my.cnf .. At least ZoneMinder perl modules are trying to use default socket.. mebbe I just missed somth - zoneminder does su for a wwwrun that had no .my.cnf in my system.
(In reply to comment #7) > Heh, had to get socket back to /var/lib/mysql/mysql.sock since perl DBI doesn't > care on /etc/my.cnf & ~/.my.cnf .. Well, that's allways the problem with moving stuff around and changing settings, it may break things that worked before... FYI, there will appear an new mysql package in the factory distribution, with the mysqld.log symlink, err-log working again and a more "user-friendly" logrotate script.
thanks! 'll upgrade. :) PS: anyway the default in /etc/skel/.my.cnf should have autorehash enabled. The complition thing is fine: .my.cnf in /etc/skel should contain the following: --cut--- [client] auto-rehash # enable tab completition --cut--- but even w/ this I've no complition for mysql commands.. But w/ old mysql 5 years old a friend of mine built I've it: --cut--- -- [ 20:51:05, root@applix, ~ ] # mysql -h xxx.xxx.xxx.xxx -p billing -u root Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 449 to server version: 3.23.49-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> sh show databases show fields from show keys from show tables mysql> show --cut--- Here after pressing sh I press <tab> . but w/ SuSE current I've nothing, but visible/audio bell (depending to konsole settings after a <tab>: --cut--- ----------------- [ 21:02:08, root@skylab, ~ ] # mysql -h localhost -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5212 to server version: 4.1.13-Max-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> sh --cut--- Does this depend to building options or something else? I 've nothing special in /etc/my.cnf @applix mashine above & 've no .my.cnf for root.
Some of the issues were fixed in 10.1. /var/lib/mysql will stay where it is (moving it will just cause confusion during update). If you really want /etc/skel/.my.cnf, then open another bugreport (as /etc/skell isn't my responsibility).