List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:July 2 1999 10:17am
Subject:Re: 3.22.23b-1 RPMs strange
View as plain text  
>>>>> "Sasha" == Sasha Pachev <sasha@stripped> writes:

Sasha> MagnusStenman wrote:
>> 
>> I run a freshly installed intel RedHat 5.2
>> with 3.22.23b-1 MySQL RPMs
>> 
>> When trying to start the MySQL server from the init scripts
>> it just starts and stops again:
>> 
>> /etc/rc.d/init.d/mysql start
>> [root@lakrits /root]# Starting mysqld daemon with databases from
>> /var/lib/mysql
>> mysqld daemon ended
>> 
>> In the error log:
>> mysqld started on  Fri Jul 2 04:13:53 CEST 1999
>> 990702  4:13:53  getpwnam: Success
>> 990702  4:13:53  Aborting
>> 
>> mysqld ended on  Fri Jul 2 04:13:53 CEST 1999
>> 
>> I tried to run it manually like this: (and variations thereof)
>> 
>> mysqld --skip-locking --user=mysql --one-thread \
>> --pid-file=/var/lib/mysql/lakrits.hkust.se.pid \
>> --basedir=/ --datadir=/var/lib/mysql
>> 
>> and got this output:
>> 990702  4:04:56  getpwnam: Success
>> 990702  4:04:56  Aborting
>> 
>> When omitting the "--user=mysql" argument, it runs fine,
>> but all threads run as user root.
>> 
>> the "mysql" user exists, and has read and write permissions
>> in /var/lib/mysql
>> 
>> I tried with and without shadow passwords.
>> 
>> I cannot get any further here...
>> 
>> /magnus
>> 

Sasha> I have seen the same problem. My solution, done in a hurry - did not
Sasha> have the time to find a better way to do it:

Sasha>  - get rid of --user=
Sasha>  - start the daemon with su -c "/path/to/safe_mysqld& " <mysql_user>

Sasha> Maybe Monty can shed some light on this. What happens exactly when
Sasha> mysqld is given --user - seteuid() to that user before anything else?

Hi!

It calls the following code:

-------
static void set_user(const char *user)
{
    struct passwd *ent;

  // don't bother if we aren't superuser
  if(geteuid())
    return;

  if(!(ent = getpwnam(user)))	<-- fails here
  {
    sql_perror("getpwnam");
    unireg_abort(1);
  }

  if (setgid(ent->pw_gid) == -1)
  {
    sql_perror("setgid");
    unireg_abort(1);
  }
  if (setuid(ent->pw_uid) == -1)
  {
    sql_perror("setuid");
    unireg_abort(1);
  }
}

-----------

I have now idea why getpwnam fails with 'success'.

Magnus;  Are you sure that you have a user named 'mysql' ?

Try typing:

id mysql

Regards,
Monty

Thread
3.22.23b-1 RPMs strangeMagnusStenman2 Jul
  • Re: 3.22.23b-1 RPMs strangeSasha Pachev2 Jul
    • Re: 3.22.23b-1 RPMs strangeMichael Widenius2 Jul
  • Re: 3.22.23b-1 RPMs strangeSasha Pachev3 Jul
  • Re: 3.22.23b-1 RPMs strangeMagnus Stenman4 Jul