nss-mysql-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nss-mysql-users] mysql not restarting and other issues


From: Jamie McClelland
Subject: [Nss-mysql-users] mysql not restarting and other issues
Date: Sat, 25 Oct 2003 16:50:08 -0400
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3) Gecko/20030312

Hi - thanks for the great software! It is really making my life a lot easier and I hope you have time to continue maintaining it. Most things are working like a charm, however I am having a few problems and have a few questions. Sorry for the long email....

ME:

Running: Redhat 9 (mysql-server 3.23.54a-11)
nss-mysql: I downloaded version .43 and untarred it. Then, I copied all the .c and .h files from the current CVS into their proper locations in the .43 untarred directory (since the CVS does not have any of the configure scripts).
nsswitch file:
passwd:     files nisplus mysql
shadow:     files nisplus mysql
group:      files nisplus mysq

1. My first problem is that mysqld is not restarting properly (I noticed that this has been a problem in the past). When I try to restart (/sbin/service mysqld restart) the init script reports that the service has been properly restarted. ps aux reports:

root 907 0.0 0.2 4400 1128 pts/1 S 14:00 0:00 /bin/sh /usr/bin/safe_mysqld --defaults-file=/etc/my.cnf root 932 0.0 0.3 5924 1996 pts/1 S 14:00 0:00 /usr/libexec/mysqld --defaults-file=/etc/my.cnf


Even /var/log/mysql.log and /var/log/messages reports the mysql started properly. However, I am unable to make a connection to it from any database client program. To properly restart it, I have to kill -9 both the pids listed above, remove "mysql" from the nsswitch.conf file and then run /sbin/service mysqld start. At which poin ps aux reports:

root 5582 0.0 0.2 4396 1124 pts/1 S 15:11 0:00 /bin/sh /usr/bin/safe_mysqld --defaults-file=/etc/my.cnf
mysql     5605  0.0  1.0 140340 5532 pts/1   S    15:11   0:00 [mysqld]

And mysql is working again. When I install nss-mysql with debug, the following lines appear when I try to restart mysql:

Oct 25 15:04:26 mail nss-mysql[5123]: passwd.c: handle_query called for name mysql.mysql, uid 0, bulk 0 Oct 25 15:04:26 mail nss-mysql[5123]: _nss_mysql_read_conf_file: called for section users Oct 25 15:04:26 mail nss-mysql[5123]: _nss_mysql_read_conf_file ended for section users
Oct 25 15:04:26 mail nss-mysql[5123]: _nss_mysql_set_fork_handler: called
Oct 25 15:04:26 mail nss-mysql[5123]: _nss_mysql_set_fork_handler: setting the fork handler
Oct 25 15:04:26 mail nss-mysql[5123]: _nss_mysql_set_fork_handler: finished
Oct 25 15:04:26 mail nss-mysql[5123]: _nss_mysql_check_connection called
Oct 25 15:04:26 mail nss-mysql[5123]: _nss_mysql_check_connection: Initiating a new connection
Oct 25 15:04:26 mail nss-mysql[5123]: _nss_mysql_db_connect: called
Oct 25 15:04:26 mail nss-mysql[5123]: _nss_mysql_db_connect: calling mysql_init(NULL) Oct 25 15:04:26 mail nss-mysql[5123]: _nss_mysql_db_connect: mysql_init() suceeded Oct 25 15:04:26 mail nss-mysql[5123]: _nss_mysql_db_connect: connection with host=xxxxxxx,user=nss,passwd=xxxxxxxx,database=xxxxxx,port=3306 Oct 25 15:04:26 mail nss-mysql[5123]: _nss_mysql_db_connect: connection failed: Can't connect to MySQL server on 'xxxxxxx' (111) Oct 25 15:04:26 mail nss-mysql[5123]: passwd.c: handle_query(): reached "out" label, result (nil) Oct 25 15:04:26 mail nss-mysql[5123]: passwd.c: leaving handle_query with status -1 (errno No such file or directory) Oct 25 15:04:26 mail nss-mysql[5125]: passwd.c: handle_query called for name mysql.mysql, uid 0, bulk 0 Oct 25 15:04:26 mail nss-mysql[5125]: _nss_mysql_read_conf_file: called for section users Oct 25 15:04:26 mail nss-mysql[5125]: _nss_mysql_read_conf_file ended for section users
Oct 25 15:04:26 mail nss-mysql[5125]: _nss_mysql_set_fork_handler: called
Oct 25 15:04:26 mail nss-mysql[5125]: _nss_mysql_set_fork_handler: setting the fork handler
Oct 25 15:04:26 mail nss-mysql[5125]: _nss_mysql_set_fork_handler: finished
Oct 25 15:04:27 mail nss-mysql[5125]: _nss_mysql_check_connection called
Oct 25 15:04:27 mail nss-mysql[5125]: _nss_mysql_check_connection: Initiating a new connection
Oct 25 15:04:27 mail nss-mysql[5125]: _nss_mysql_db_connect: called
Oct 25 15:04:27 mail nss-mysql[5125]: _nss_mysql_db_connect: calling mysql_init(NULL) Oct 25 15:04:27 mail nss-mysql[5125]: _nss_mysql_db_connect: mysql_init() suceeded Oct 25 15:04:27 mail nss-mysql[5125]: _nss_mysql_db_connect: connection with host=xxxxx,user=nss,passwd=xxxxx,database=xxxxx,port=3306 Oct 25 15:04:27 mail nss-mysql[5125]: _nss_mysql_db_connect: connection failed: Can't connect to MySQL server on 'xxxxx' (111) Oct 25 15:04:27 mail nss-mysql[5125]: passwd.c: handle_query(): reached "out" label, result (nil) Oct 25 15:04:27 mail nss-mysql[5125]: passwd.c: leaving handle_query with status -1 (errno No such file or directory)
Oct 25 15:04:27 mail nss-mysql[5155]: setent called for group(1)
Oct 25 15:04:27 mail nss-mysql[5155]: _nss_mysql_set_fork_handler: called
Oct 25 15:04:27 mail mysqld: Starting MySQL:  succeeded
Oct 25 15:04:27 mail nss-mysql[5155]: _nss_mysql_set_fork_handler: setting the fork handler
Oct 25 15:04:27 mail nss-mysql[5155]: _nss_mysql_set_fork_handler: finished
Oct 25 15:04:27 mail nss-mysql[5155]: _nss_mysql_read_conf_file: called for section groups Oct 25 15:04:28 mail nss-mysql[5155]: _nss_mysql_read_conf_file ended for section groups
Oct 25 15:04:28 mail nss-mysql[5155]: _nss_mysql_db_connect: called
Oct 25 15:04:28 mail nss-mysql[5155]: _nss_mysql_db_connect: calling mysql_init(NULL) Oct 25 15:04:28 mail nss-mysql[5155]: _nss_mysql_db_connect: mysql_init() suceeded Oct 25 15:04:28 mail nss-mysql[5155]: _nss_mysql_db_connect: connection with host=xxxxx,user=nss,passwd=xxxxx,database=xxx,port=3306

In comparison with that problem, the rest are minor:

2. If you are using shadow passwords, the database user privileges need to be tweaked.

I couldn't get nss-mysql to work until I installed it with debug enables and then tailed /var/log/messages, at which point I noticed a bunch of my own typo mistakes, but also that the nss and nss-shadow users did not have the proper privileges. Following is a revision of the sql instructions in the SHADOW file. The fields in caps are ones that I added

$ mysql -u root -p mysql

> GRANT select(user_name,user_id,uid,gid,realname,shell,homedir,STATUS) on
  nss-myql.user to address@hidden identified by 'password';

> GRANT select(group_name,group_id,gid,GROUP_PASSWORD,STATUS) on nss-mysql.groups to address@hidden
  identified by 'password';

> GRANT select(user_id,group_id) on nss-mysql.user_group to address@hidden;
  identified by 'password';

## NOTE if you want to include lastchange,min,max,expire,warn or inact
## shadow extentions in your database, you must add these columns to the
## following SQL request.

> GRANT select(user_name,password,user_id,STATUS,NAME) on nss-mysql.user to 'nss-shadow'@localhost
  identified by 'another_password';

3. I also noticed from the log that nss-mysql complains if your "lastchange" field is empty. It doesn't cause any problems, however, perhaps the default value for this field should be 1 or something to prevent the error.

4. There is a probably a good reason for this, but I noticed, while in debug mode, that both the passwd and shadow sql statements seemed to called repeatedly (the exact same statement for the same user) during a single login request.

5. Also (maybe a good reason too) but ... during a single login request, all groups are returned (which can take a while) rather than just the groups that the user trying to login to belongs to.

Ok, that's it. Thanks again for the software.

Jamie





reply via email to

[Prev in Thread] Current Thread [Next in Thread]