LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 03-03-2004, 09:51 PM   #1
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 758

Rep: Reputation: 36
path and mysql questions


In dos I can use path=c:\windows\somepath\ so that if I type the name of an executable inside of somepath, it will execute it even if I'm not in somepath, what is the equivalent of this in linux? I just installed mysql, I don't even know if I did it right, but as a start I want to set the path to the /usr/local/mysql/bin/ directory so I don't always have to type ./command in the folder.

Also, speaking of mysql, when I try to start mysqld, it errors out:

Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
040303 22:48:58 Aborting

040303 22:48:58 ./mysqld: Shutdown Complete


I AM running it as root... I even tried to type su root to be extra sure but that did not do anything. For some reason it does not realize that I'm under root.
Also, this is the package as it was downloaded, do I need to like ./configure [enter] make [enter] make install [enter] it? I did not see anything in the readme files about that, but I know they like to exept lot of stuff in documentation sometimes. I know I have to modify apache configuration one way or the other for it to work, but that was not mentioned in the documentation so I don't know how to do that either.
 
Old 03-04-2004, 02:33 AM   #2
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,438

Rep: Reputation: 52
Ahh, the joys of mysql .

Quote:
I don't even know if I did it right, but as a start I want to set the path to the /usr/local/mysql/bin/ directory so I don't always have to type ./command in the folder.
well, you can edit your .bashrc file and place the path in there. Once you do that, you need to run the 'source' command to make it into effect.

Quote:
Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
How did you exactly install mysql? Source or rpm? If it is source then yes, you do need to run './configure', 'make', 'make install'. I think it would be better for you to install it as rpm's instead to make your life a little easier.


-twantrd
 
Old 03-04-2004, 05:31 PM   #3
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 758

Original Poster
Rep: Reputation: 36
I installed it from source, but it said I did not need to do the configure, that it was already configured. It told me to extract the file to /usr/local/mysql so I assume it's preconfigured or something. How would I manage to get the RPM? I just went to the mysql site and downloaded it. This is what I get if I do try it:



[root@localhost mysql]# ./configure
NOTE: This is a MySQL binary distribution. It's ready to run, you don't
need to configure it!

To help you a bit, I am now going to create the needed MySQL databases
and start the MySQL server for you. If you run into any trouble, please
consult the MySQL manual, that you can find in the Docs directory.

Installing all prepared tables
040304 18:31:58 ./bin/mysqld: Shutdown Complete


To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
See the manual for more instructions.

NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run
the ./bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the ./bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com

Starting the mysqld server. You can test that it is up and running
with the command:
./bin/mysqladmin version
[root@localhost mysql]# Starting mysqld daemon with databases from /usr/local/mysql/data
040304 18:31:58 mysqld ended


[root@localhost mysql]#


So it does do something, but it's not the same as usual.
 
Old 03-04-2004, 07:28 PM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
The README file from the MySQL tarball you extracted should contain instructions on what to add to your $PATH variable.
You probable need to add the path /usr/local/mysql/bin in your .bashrc or .bash_profie.

Check out man bash and decide which startup file you need to modify. Depends on who you want using it.

Don't add the current directory './' to your path variable. If a hacker can add a file named after a common command. If you happen to be in that directory and execute the command, his command will run instead.
 
Old 03-04-2004, 07:36 PM   #5
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 758

Original Poster
Rep: Reputation: 36
Also, are commands or "scripts" the same concept as ms dos batch files, where you can have a serries of commands? I was exploring in the init.d folders and stuff and all the scripts look like more complex code similar to C++ or something.
 
Old 03-04-2004, 08:03 PM   #6
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 758

Original Poster
Rep: Reputation: 36
ok I just tried to add folding@home in the file, but now when I login to ssh I get F@H instead of the normal client. Is there a way to make it startup as a normal local console? I just want a console to popup instead of having it run in the main console, if you know what I mean. Or if there's a way to make it work completly in the background it would be great too, but with the seperate console then I could see the progress as well.
 
Old 03-04-2004, 08:25 PM   #7
lsmith
Member
 
Registered: Feb 2004
Posts: 40

Rep: Reputation: 15
Regarding the path:

There is a terminal enviroment variable called PATH that does the same thing as the windows equivalent. However Linux is case sensitive. 'Path' won't work. It must all be upper case.

Take a look at your current path using:

echo $PATH

Take a look at all your environment variables using:

env

This command will add /usr/local/mysql/bin/ to your path:

export PATH=$PATH:/usr/local/mysql/bin/

This says 'make PATH equal to whatever PATH is now, plus ':/usr/local/mysql/bin/ ' on the end. The paths must be seperated by colons.

If you want your PATH to always contain /usr/local/mysql/bin/ , add that same command into the file named .bashrc which is in your home directory. If the file is not there already, create it. By the way you have to do ls -a to see files that begin with a '.'

Yes - scripts are the same as batch file in windows. However linux scripts can be far more complicated and can do far more things than in windows - like have functions and stuff inside them. The scripts in init.d are good examples of these.

Scripts that are to be run by bash must have the following as the first line:

#!/bin/bash

and their permissions must be set to executable for them to be run.

There are lots of pages dedicated to bash scripting on the net. Search from google for 'bash scripting'.

By the way - I think the message that mysql is giving you is that you would usually not run mysql as root - and that the manual tells you how if you really want to. It is a security risk to have a database process running as root - because then that process can do anything. If someone manages to get it to execute their code, there are no checks in place.

Last edited by lsmith; 03-04-2004 at 08:26 PM.
 
Old 03-04-2004, 09:24 PM   #8
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 758

Original Poster
Rep: Reputation: 36
How would I manage to make it run under a different user? Do I need to create a new user and log in as that user? That would mean I can't get it to run as soon as linux boots, I'd have to login to the computer as that user.
 
Old 03-04-2004, 09:37 PM   #9
lsmith
Member
 
Registered: Feb 2004
Posts: 40

Rep: Reputation: 15
Yes you will need to learn how to create and administer users in linux. You may want to read the documentation for mysql too incase the user needs certain permissions. You will probably want to create a user just for the mysql stuff. I don't know anything about mysql sorry so I don't know how to set it up - but there will certainly be documentation that you must read.

There is no reason that a process can't run under a different user, but still run as soon as linux boots. The 'su' command lets you execute commands as other users. Use the man pages for su (enter 'man su') to find out more.
 
Old 03-04-2004, 09:50 PM   #10
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 758

Original Poster
Rep: Reputation: 36
Actually part of the instructions said to create a user and group called mysql and I did, but it never meantioned anything after. The documentation just "ends" leaving me blinded for the rest of the setup. From there I figured I could simply start mysqld but there's more to it then that I assume. I deleted that install though, I rather do one where Ihave to do the ./configure and stuff with all the arguments since I found a tutorial on the net that tells me what to put after ./configure. documentation never says that, they just say to type ./confugre [...] assuming the user knows what [...] suppost to be LOL.

So I guess I need to su as mysql then run it correct?
 
Old 03-05-2004, 03:59 PM   #11
mpgram
Member
 
Registered: Sep 2003
Location: Dallas TX
Distribution: Red Hat
Posts: 59

Rep: Reputation: 15
I am not sure how helpful this will be, but after mine was installed, I did the following....

$ su
password: **



# mysqladmin -u root -p password (or what ever you want your password to be) I beleive that is the correct statement.

# mysql -u root -p
password: ********

mysql>


Hope that helps. Oh, by the way, if that does not work, login as root. I had issues running it as myself and su-ing.

Last edited by mpgram; 03-05-2004 at 04:02 PM.
 
Old 03-07-2004, 12:38 AM   #12
Whatshisface
Member
 
Registered: Aug 2003
Location: Chesapeake Beach, MD
Distribution: Mandrake 9.2
Posts: 58

Rep: Reputation: 15
Can anyone tell me what I'm doing wrong here? Here is my error when I try to start MySQL:
prompt>mysql -h localhost -u logan -p
Enter password:********
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
prompt>
 
Old 03-07-2004, 01:56 PM   #13
lsmith
Member
 
Registered: Feb 2004
Posts: 40

Rep: Reputation: 15
Quote:
Originally posted by mpgram
I am not sure how helpful this will be, but after mine was installed, I did the following....

$ su
password: **



# mysqladmin -u root -p password (or what ever you want your password to be) I beleive that is the correct statement.

# mysql -u root -p
password: ********

mysql>


Hope that helps. Oh, by the way, if that does not work, login as root. I had issues running it as myself and su-ing.
Possibly because if you want to become root user, AND inherit the environment of the root user (as if you had logged in) then the command is:

su -

The '-' on the end tells it to log you in, rather than just switching UID.
 
Old 03-07-2004, 03:16 PM   #14
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 758

Original Poster
Rep: Reputation: 36
Quote:
Originally posted by Whatshisface
Can anyone tell me what I'm doing wrong here? Here is my error when I try to start MySQL:
prompt>mysql -h localhost -u logan -p
Enter password:********
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
prompt>
That's what I get. You need to start mysqld, but when I try that, I get another error. It does not say anything revelent, it says something like:

"error: see manual to know how to run under root. mysqld ended"

It does not say what the error actually is. I am running it under root, and I also tried running it under mysql user but got the same error.
 
  


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
Apache path and kde path questions darkraider Debian 1 11-12-2005 05:07 AM
Two questions: $PATH and some apt-get help. Lokathor Debian 7 10-28-2005 12:21 AM
Mysql:how can I add the lib path in Kylix walkinmud Programming 4 09-24-2004 09:48 AM
Some path questions and installing Pico Mathius Linux - Newbie 1 07-04-2003 01:03 PM
MySQL questions Thinkgeekness Linux - Software 3 04-08-2003 09:04 PM


All times are GMT -5. The time now is 10:39 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration