Rant on Debian and MySQL

News and discussion about development of the Debian OS itself

Rant on Debian and MySQL

Postby magice » 2010-07-17 03:01

Hello fellow Debian user!

I have just had the most annoying hours of my GNU/Linux life thank to the all-so-genius packaging of mysql (Squeeze for ARMel). Isn't it the best way to package software ever: change a random (but important) piece of configuration, refuse the user from configurating it altogether, and let all other packages think that normal stuffs are going on. Yeah, right.

Okay, as we all know, MySQL has an initial user called 'root' with universal permission and used to set stuffs (aka other users + databases) up. Debian package (sorry, not know for sure which package is at fault, although I suspect mysql-server) decides that it doesn't like that name, and make the use into debian-sys-maint for no particular reason. BETTER, there is a little configuration during installation of mysql which nicely ask me what password for root that I wish to be. Well, this choice have NO EFFECT whatsoever. Just throw it out there, eh? BEST, here is the best part, dbconfig-common use 'root'@'localhost', which simply does NOT exist. Fun fun fun. In other words, except the case when the admin actually creates and grants permissions to a user named root in MySQL, NOTHING with mysql can be configured properly. Super fun.

For example, I tried to install torrentflux. As experience when, I typed in 'apt-get install torrentflux', then y, then expected stuffs to just happen, as they usually do. But God, no. dbconfig-common reports error. I then thought, hm, I must have misconfigured mysql somewhere, so let's log in and see. 'mysql -u root' rejected me, no matter what combination of password I fed into it. Dejected, I purged mysql (all of it), and reinstalled everything, this time with no admin password. Nope, did NOT work. Google, surprisingly, did NOT return anything useful. Oh, while purging, apt returned errors, something about /etc/mysql being broken and couldn't be removed (yeah, good packaing, guy, now I could not properly purge stuffs), so I looked into that, and found out about the oh-so-mysterious 'debian-sys-maint'. Punch into MySQL, and it worked! Magic! Innocently, I tried to create 'root'@'localhost', and install torrentflux again, only to know (again) that root was broken: it needed permission. Once all permissions were granted, stuffs worked.

In conclusion, instead of, what, 10 seconds of apt, it prolonged into 2 hours of wrestling. For WHAT reason? I mean, seriously, if my harddrive breaks, I can digest. If the package is something obscure from the beginning of time, I digest that, too. If the code cannot be compiled, or is written with some other system in mind, and does not work nicely Linux, I digest that, too. If the program is too bleeding edge (kind of like Xen a few years ago), I digest that, too. But, for Goodness' sake, it's MYSQL. I don't even know of how to set up ANY system without proper installation of MySQL. Seriously? F**k up MySQL? This must be a joke.

Thank you for the excellent disto, and can someone please, PLEASE fix this?
Posts: 7
Joined: 2009-03-21 00:44

Re: Rant on Debian and MySQL

Postby craigevil » 2010-07-17 07:03

Check the BTS and if there isn't a bug report for what you ran into file one.

Code: Select all
apt-get install mysql-server php5-mysql

Replace the following string NewRootDatabasePassword with a secure password of your own choosing.
There is no space between the -p and the password on the second command.
Code: Select all
mysqladmin -u root password NewRootDatabasePassword
mysqladmin -u root -h localhost password NewRootDatabasePassword -pNewRootDatabasePassword
Debian Sid KDE Kernel 3.17 Thinkpad R40 Intel M 1.3 CPU 2GB RAM Radeon Mobility 7500
Debian - "If you can't apt-get something, it isn't useful or doesn't exist"
Debian upgrade script smxi | sysinfo script inxi
User avatar
Posts: 5192
Joined: 2006-09-17 03:17
Location: Oz

Re: Rant on Debian and MySQL

Postby bugsbunny » 2010-07-17 20:01

Did you ever bother to check the readme files in /usr/share/doc? I don't have mysql installed (I use postgres) but the following is from /usr/share/doc/mysql-server-5.1/README.Debian.gz

You may never ever delete the special mysql user "debian-sys-maint". This
user together with the credentials in /etc/mysql/debian.cnf are used by the
init scripts to stop the server as they would require knowledge of the mysql
root users password else.
So in most of the times you can fix the situation by making sure that the
debian.cnf file contains the right password, e.g. by setting a new one
(remember to do a "flush privileges" then).
The MySQL manual describes certain steps to do at this stage in a separate
chapter. They are not necessary as the Debian packages does them

The only thing that is left over for the admin is
- setting the passwords
- creating new users and databases
- read the rest of this text
It is strongly recommended to set a password for the mysql root user (which
/usr/bin/mysql -u root -D mysql -e "update user set password=password('new-password') where user='root'"
/usr/bin/mysql -u root -e "flush privileges"
If you already had a password set add "-p" before "-u" to the lines above.

If you are tired to type the password in every time or want to automate your
scripts you can store it in the file $HOME/.my.cnf. It should be chmod 0600
(-rw------- username username .my.cnf) to ensure that nobody else can read
it. Every other configuration parameter can be stored there, too. You will
find an example below and more information in the MySQL manual in
/usr/share/doc/mysql-doc or www.mysql.com.

ATTENTION: It is necessary, that a .my.cnf from root always contains a "user"
line wherever there is a "password" line, else, the Debian maintenance
scripts, that use /etc/mysql/debian.cnf, will use the username
"debian-sys-maint" but the password that is in root's .my.cnf. Also note,
that every change you make in the /root/.my.cnf will affect the mysql cron
script, too.
User avatar
Posts: 5355
Joined: 2008-07-06 17:04

Re: Rant on Debian and MySQL

Postby magice » 2010-07-19 02:34

Here are my points:
  • Why should Debian set thing up differently from just about any other system? By that, I include Fedora (which I expect to be the same as Red Hat), Windows, or anything else? I thought that "Embrace, Extend, Extinguish" is something Microsoft would do, not a GNU/Linux distro.
  • Why should the installer ask information that is never used? This is absurd, if not down right stupid. Generally speaking, we don't need to dumb down software for "Joe the everyday user," but that doesn't mean throwing in random junks that obscure the usage.
  • Why are other tools not aware of this difference? Seriously. Why should they use 'root'@'localhost' account, when there is none created by default, and then never ever suspect if the admin has set that up? Oh, maybe because that the standard way (which leads to the first point). However, if you are gonna stray, at least stray all the way. I mean, would it hurt if apt tells me something like "please set up 'root' account for your MySQL installation, since the data I collect are just for fun"?
Posts: 7
Joined: 2009-03-21 00:44

Re: Rant on Debian and MySQL

Postby bugsbunny » 2010-07-19 08:46

File a bug and see what the maintainer says.

I may try installing mysql just to see what happens, I'll think about it. Which version of mysql did you install (from lenny, backports, testing)?
User avatar
Posts: 5355
Joined: 2008-07-06 17:04

Re: Rant on Debian and MySQL

Postby jheaton5 » 2010-07-19 09:56

I use mysql on a daily basis and have no problems. Set up is simple and easy. I suspect this is not a mysql problem.

Mysql server is on a headless server running lenny. I have mysql client installed on all my computers and can access my databases through Navagator.
debian sid
User avatar
Posts: 1489
Joined: 2008-08-20 01:40
Location: Newnan, GA, USA

Return to Debian Development

Who is online

Users browsing this forum: No registered users and 3 guests