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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
09-28-2012, 01:05 PM
|
#1
|
|
Member
Registered: Jul 2009
Posts: 71
Rep:
|
Starting mysql using login script
Hi,
Can sombody plz guide me how to start mysql using a login script. I dont want to type pasword.
Zulfi.
|
|
|
|
09-28-2012, 02:57 PM
|
#2
|
|
Member
Registered: Feb 2009
Location: Goa(India)-Sharjah(UAE)
Distribution: RHEL,centos,fedora,ubuntu
Posts: 214
Rep:
|
can you please elaborate
what operating system your using , the version of mysql etc ...
what do u mean by login script ? what are you trying to achieve?
|
|
|
|
09-29-2012, 02:11 AM
|
#3
|
|
Member
Registered: Jul 2009
Posts: 71
Original Poster
Rep:
|
Hi,
Thanks for your response. I am using Fedora 1o. I want to start sqld and some people on this forum helped me for this. However I have to use :
commands which asks password. That's why I want to create a login script so that no body can see the passwd. Kindly guide me:
i)how to write the script for executing the above commands without providing the passwd. The script should be able to execute at the time of guest user's login.
ii) in which file i have to store the script.
Zulfi.
Last edited by zak100; 09-29-2012 at 02:13 AM.
|
|
|
|
09-29-2012, 12:39 PM
|
#4
|
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,780
|
Is there a specific reason why you don't want the mysql daemon to be started at startup?
Quote:
|
commands which asks password. That's why I want to create a login script so that no body can see the passwd.
|
Nobody can see the password when you type it
Quote:
|
how to write the script for executing the above commands without providing the passwd
|
Not possible (to my knowledge) when using 'su'. I guess Fedora has support for 'sudo', so you should be able to set that up so (one or more) users can start the mysql daemon without need for a password.
A last note: your title states mysql (the mysql client), your thread is about mysqld (the mysql daemon). There is a difference between the two 
|
|
|
|
09-29-2012, 01:11 PM
|
#5
|
|
Member
Registered: Jul 2009
Posts: 71
Original Poster
Rep:
|
Thanks for the correction of the title.
Quote:
Is there a specific reason why you don't want the mysql daemon to be started at startup?
|
No. This is what i want. mysqld is not starting at boot time. I have to first login to guest account and then i have to run mysqld. Its a teaching environment. I want to start it after the OS (Fedora) is loaded or after the guest login. Otherwise i have to run mysqld on all PCs and this would allow leakage of passwd.
I want to start mysqld at startup or at guest login and this is what i am looking for.
I dont know about sudo but how can i use it in a login script?
Zulfi.
|
|
|
|
10-01-2012, 02:31 AM
|
#6
|
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,780
|
Quote:
|
I want to start mysqld at startup or at guest login
|
If it does not matter, let it start when the system boots (you don't need to know the password for that). If that does not work, check why it does not work and fix that. I'm not a fedora man so I can't say what to do to get it automatically started in fedora.
Quote:
|
I dont know about sudo but how can i use it in a login script?
|
But you have to setup 'sudo', something I have not played with.
Maybe more knowledgeable people can give the finer details.
|
|
|
|
10-01-2012, 04:39 AM
|
#7
|
|
LQ Newbie
Registered: Sep 2012
Location: kerala
Distribution: debian
Posts: 11
Rep:
|
see http://www.mjmwired.net/resources/mj...es.html#enable
It explain how to set up services in fedora.
There is some graphical utilities where you can enable or disable services by clicking the checkboxes.
or you can allow some users with permission to run specified commands as root by sudo, all you need is to edit /etc/sudoers file using visudo.
eg:-
[user] ALL=(ALL) NOPASSWD: [command]
replace [user] and [command] with appropriate values.
then you can execute:
sudo [command] without any password if logged in as [user].
Also check.
man sudo
man sudoers
|
|
|
|
10-01-2012, 12:51 PM
|
#8
|
|
Member
Registered: Jul 2009
Posts: 71
Original Poster
Rep:
|
Thanks _dkode_ and Wim Sturkenboom. I would try on your advice.
Zulfi.
|
|
|
|
10-02-2012, 05:27 AM
|
#9
|
|
Member
Registered: Jul 2009
Posts: 71
Original Poster
Rep:
|
Hi,
I tried to change the following line in sudoers file:
Code:
# %wheel ALL=(ALL) NOPASSWD:ALL
with
Code:
guest ALL=(ALL) NOPASSWD:sqld
but its giving me error when i tried to save the file. It says:
Code:
>>> sudoers file: syntax error, line 84 <<<
what now?
Kindly guide me.
Zulfi.
Last edited by zak100; 10-02-2012 at 05:30 AM.
Reason: typing error
|
|
|
|
10-02-2012, 07:52 AM
|
#10
|
|
LQ Newbie
Registered: Sep 2012
Location: kerala
Distribution: debian
Posts: 11
Rep:
|
use the full path(absolute path) for the command.
if you don't know the path, use 'whereis' to find it.
Assuming you need to run sqld as root.
#whereis sqld
this will give you the path, lets say /usr/sbin/sqld
then you can change your sudoers entry to:
Quote:
|
guest ALL=(ALL) NOPASSWD: /usr/sbin/sqld
|
you may need to use mysqld instead of sqld
|
|
|
|
10-03-2012, 05:37 AM
|
#11
|
|
Member
Registered: Jul 2009
Posts: 71
Original Poster
Rep:
|
Hi,
Thanks for your response.
I tried :
Code:
## Same thing without a password
guest ALL=(ALL) NOPASSWD: /usr/libexec/mysqld
but I am getting following error:
Code:
[guest@HP-UX646UU ~]$ sudo service mysqld start
[sudo] password for guest:
Sorry, user guest is not allowed to execute '/sbin/service mysqld start' as root on HP-UX646UU.
[guest@HP-UX646UU ~]$
The root path for mysqld is:
Code:
[guest@HP-UX646UU ~]$ su
Password:
[root@HP-UX646UU guest]# whereis mysqld
mysqld: /usr/libexec/mysqld /usr/share/man/man8/mysqld.8.gz
Kindly guide me with this problem.
Zulfi.
|
|
|
|
10-03-2012, 07:51 AM
|
#12
|
|
LQ Newbie
Registered: Oct 2012
Posts: 6
Rep: 
|
I'm a bit of a noob, so I may be wrong, but I didn't think gz was a type of executable file? Google seems to confirm this.
Also, it would appear that you may have changed your sudoers file to make the sudo command log in as guest, not as root.
|
|
|
|
10-03-2012, 11:42 AM
|
#13
|
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,780
|
@Shammyhealz: Look at the location the the gz-file; it's just the man page for mysqld
|
|
|
|
10-04-2012, 03:52 AM
|
#14
|
|
LQ Newbie
Registered: Sep 2012
Location: kerala
Distribution: debian
Posts: 11
Rep:
|
You are using: sudo service mysqld start
you need to add the command /sbin/service mysql start, in sudoers.
not mysqld
*edited
Quote:
Code:
## Same thing without a password
guest ALL=(ALL) NOPASSWD: /usr/libexec/mysqld
but I am getting following error:
Code:
Code:
[guest@HP-UX646UU ~]$ sudo service mysqld start
[sudo] password for guest:
Sorry, user guest is not allowed to execute '/sbin/service mysqld start' as root on HP-UX646UU.
[guest@HP-UX646UU ~]$
|
in this settup you can run, without password
to execute
Code:
sudo service mysqld start
without password, you need to add entry
Code:
guest ALL=(ALL) NOPASSWD: /sbin/service mysqld start
there is also a short cut to allow executing all command as root without password in sudo, I use that in my servers. but it is dangerous if the guest account is accessible to persons other than administrators. if you use it, use with care or do not use.
Code:
guest ALL=(ALL) NOPASSWD: ALL
Last edited by _dkode_; 10-04-2012 at 09:22 AM.
Reason: deta
|
|
|
|
10-04-2012, 04:24 AM
|
#15
|
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian Squeeze (server), Slackware 13.37 (netbook), Slackware64 14.0 (desktop),
Posts: 8,358
|
Quote:
Originally Posted by Wim Sturkenboom
If it does not matter, let it start when the system boots (you don't need to know the password for that). If that does not work, check why it does not work and fix that.
|
+1 to that. It is the normal way to start mysqld and is routinely used on many many systems.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:41 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|