Linux - NewbieThis 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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 :
Code:
su
mysqld
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.
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
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?
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?
Code:
sudo mysqld
But you have to setup 'sudo', something I have not played with.
Maybe more knowledgeable people can give the finer details.
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].
## 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 ~]$
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 ~]$
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.