LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-15-2014, 11:16 PM   #1
zak100
Member
 
Registered: Jul 2009
Posts: 225

Rep: Reputation: 2
Avoiding typing password for starting mysqld


Hi,
I am starting mysqld by typing root passwd.
Code:
[lab6@localhost Sir]$ su
Password: 
[root@localhost Sir]# service mysqld start
Redirecting to /bin/systemctl start  mysqld.service
[root@localhost Sir]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.38 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

I have other option to create sudoers file. But i saw some administrators typing some command and after that we dont have to use su's password to start mysqld. I am working on Fedora 20.

Please guide me.

Zulfi.
 
Old 09-16-2014, 12:17 AM   #2
zak100
Member
 
Registered: Jul 2009
Posts: 225

Original Poster
Rep: Reputation: 2
Hi,
I now remember he was using something like:
Code:
/bin/systemctl start  mysqld.service
Somebody please guide me with the correct command. I dont want to try anything until i know about it.

Zulfi.
 
Old 09-16-2014, 04:45 AM   #3
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 843

Rep: Reputation: 201Reputation: 201Reputation: 201
Using /bin/systemctl start, you can start (or restart or shtop) many services and daemons.

This start is not directly related to the command line argument "start" used in "service mysqld start".

See http://www.linuxbrigade.com/centos-7...temd-commands/ for more examples.

OK
 
Old 09-16-2014, 08:53 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,395

Rep: Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395
You don't need a passwd to start it.
You only need it to login, which is what you're doing after you started it.
No need to login unless you want to start typing SQL cmds.
 
Old 09-17-2014, 03:25 AM   #5
zak100
Member
 
Registered: Jul 2009
Posts: 225

Original Poster
Rep: Reputation: 2
Hi,
If I dont login as root, i am getting:
Code:
[lab6@localhost ~]$ service mysqld start
Redirecting to /bin/systemctl start  mysqld.service
Failed to issue method call: Access denied
[lab6@localhost ~]$
Kindly guide me.

Zulfi.
 
Old 09-17-2014, 03:32 AM   #6
pratik.oturkar
LQ Newbie
 
Registered: Feb 2011
Posts: 18

Rep: Reputation: 1
your user is lab6 try to start service using root or su -
 
Old 09-17-2014, 04:31 AM   #7
zak100
Member
 
Registered: Jul 2009
Posts: 225

Original Poster
Rep: Reputation: 2
Hi,
Thanks for your message. If I start by logging as root, it will work but in that case I have to write root's password. I am working in a student environment. I don't want to tell root password to students. This is my problem. I want to start mysqld using a command which does not require root password.

Zulfi.
 
Old 09-17-2014, 05:03 AM   #8
zak100
Member
 
Registered: Jul 2009
Posts: 225

Original Poster
Rep: Reputation: 2
Hi,

I am trying to stop httpd using service command but its not working.
Code:
[root@localhost httpprg]# service stop httpd
[root@localhost httpprg]# ps aux | grep httpd
root      2268  0.0  0.1 209488  4848 ?        Ss   05:39   0:00 /usr/sbin/httpd -DFOREGROUND
apache    2269  0.0  0.0 209620  3176 ?        S    05:39   0:00 /usr/sbin/httpd -DFOREGROUND
apache    2270  0.0  0.0 209620  3176 ?        S    05:39   0:00 /usr/sbin/httpd -DFOREGROUND
apache    2271  0.0  0.0 209488  2480 ?        S    05:39   0:00 /usr/sbin/httpd -DFOREGROUND
apache    2272  0.0  0.0 209488  2480 ?        S    05:39   0:00 /usr/sbin/httpd -DFOREGROUND
apache    2273  0.0  0.0 209488  2480 ?        S    05:39   0:00 /usr/sbin/httpd -DFOREGROUND
apache    2296  0.0  0.0 209488  2480 ?        S    05:39   0:00 /usr/sbin/httpd -DFOREGROUND
root      2617  0.0  0.0 112664   928 pts/0    S+   05:58   0:00 grep --color=auto httpd
[root@localhost httpprg]#
Even i typed "localhost" and its still displaying the apache web server page.
Kindly guide me.
Zulfi.
 
Old 09-17-2014, 05:20 AM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,395

Rep: Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395
You might find this useful http://www.wikihow.com/Restart-Services-in-Linux ie its 'service <service-name> <command>', so in your case
Code:
service httpd stop
Note also that a client's browser will continue to display the last thing you asked for; this is because http is a stateless protocol https://en.wikipedia.org/wiki/Hypert..._session_state.


If you really want a non-privileged user to be able to start/stop a service like httpd, look into the sudo cmd.
http://linux.die.net/man/8/sudo and http://linux.die.net/man/5/sudoers
 
Old 09-17-2014, 08:45 AM   #10
Germany_chris
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Arch
Posts: 1,027

Rep: Reputation: 482Reputation: 482Reputation: 482Reputation: 482Reputation: 482
Quote:
Originally Posted by chrism01 View Post
You might find this useful http://www.wikihow.com/Restart-Services-in-Linux ie its 'service <service-name> <command>', so in your case
Code:
service httpd stop
Note also that a client's browser will continue to display the last thing you asked for; this is because http is a stateless protocol https://en.wikipedia.org/wiki/Hypert..._session_state.


If you really want a non-privileged user to be able to start/stop a service like httpd, look into the sudo cmd.
http://linux.die.net/man/8/sudo and http://linux.die.net/man/5/sudoers

Not with systemd it's

systemctl start program.service

and to start on boot

systemctl enable program.service
 
Old 09-18-2014, 12:44 AM   #11
zak100
Member
 
Registered: Jul 2009
Posts: 225

Original Poster
Rep: Reputation: 2
Hi,
I tried:
Code:
[lab6@localhost ~]$ service httpd start
Redirecting to /bin/systemctl start  httpd.service
Failed to issue method call: Access denied
[lab6@localhost ~]$ /bin/systemctl start httpd.service
Failed to issue method call: Access denied
[lab6@localhost ~]$ systemctl start httpd
Failed to issue method call: Access denied
[lab6@localhost ~]$
I think you are right:
Quote:

If you really want a non-privileged user to be able to start/stop a service like httpd, look into the sudo cmd.
There is no other technique other than sudo to solve this. But then i have to modify the file on every PC manually. Kindly guide me if i can modify the sudo file on all PCs through only one PC.

Zulfi.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Trouble starting mysqld bluegospel Linux - Server 5 08-14-2013 11:17 AM
setuid not avoiding password for scp OtagoHarbour Linux - Server 7 10-29-2012 02:19 PM
starting mysqld + OpenBSD Gsee *BSD 0 02-01-2005 05:36 AM
starting mysqld zobra Linux - Software 6 12-06-2004 11:27 PM
HELP! mysqld starting problem pravi Linux - Software 1 10-27-2004 11:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration