Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.


  Search this Thread
Old 06-10-2005, 02:14 PM   #1
LQ Newbie
Registered: Jun 2005
Location: wv
Posts: 4

Rep: Reputation: 0
Post New User question: Get hostname

I am very new to Linux. Just installed my first Mandriva Linux 10.1 OS. Now I want to install MySQL on it. I have used mysql on Windows XP. To use one peice of software that I use with mysql, I have to have to host name or IP address of the machine running MySql. We use DHCP, so everytime the machine boots, it gets a different IP so I can not rely on the IP address. In Windows, I can just click on control panel and then system and then Computer name which is also the hostname. How do I get the Hostname/Computer name in Madrake Linus 10.1???

Thank you for the help.

Old 06-10-2005, 02:33 PM   #2
Senior Member
Registered: Mar 2005
Location: Las Vegas, NV
Distribution: Mandriva Slackware FreeBSD
Posts: 1,468

Rep: Reputation: 48
You can use:

uname -a

for Network info:
netstat -nr
ifconfig -a

Just a few ways to do it...

Old 06-10-2005, 02:34 PM   #3
LQ Newbie
Registered: Jul 2003
Location: Boulder, Colorado
Distribution: Mandrake
Posts: 16

Rep: Reputation: 0

If you just want the IP address of the machine you're on, use 'ifconfig <interface>' (most likely eth0). That will give you a whole slew of information, including the IP address. If you the need the hostname as well, you can use the command 'hostname' with various options. Type 'man hostname' for more info. Shout if that doesn't work for you.

Old 06-10-2005, 02:57 PM   #4
LQ Newbie
Registered: Jun 2005
Location: wv
Posts: 4

Original Poster
Rep: Reputation: 0
Thank you for the help!!!

Old 06-12-2005, 11:56 PM   #5
Registered: Nov 2004
Location: Amarillo, TX
Distribution: Mandriva
Posts: 91

Rep: Reputation: 15
Simply typing "hostname" will give you your hostname.

Typing "hostname" (for example) will assign your hostname to ''.

Placing all this in /etc/sysconfig/network makes it permanent. Here is mine:


Note that this is my local network and it is not available on the Internet. However, you need to do this for your local network to make Apache and ftp work.

Don't forget your hosts file, /etc/hosts:

# localhost.localdomain localhost #sshd fails here. localhost proton graviton neutron quark photon meson lepton

My other machines are named for atomic particles, but you can use the Table of Elements (common) or the Moons of the Solar System (I think there are 160 odd).

Try not to assign user names for machine names, or your users/passwords will start getting confused with your machine/domain names.

Each machine has to have a name, and then you must also name your network. And since you are a network, then .net is obvious.



Last edited by mhearne; 06-13-2005 at 12:10 AM.


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
Hostname question GUIPenguin Linux - Networking 1 01-18-2005 09:59 PM
hostname question?? rnj Linux - Newbie 1 10-08-2004 08:09 AM
hostname question wendallsan Linux - Networking 4 10-16-2003 05:46 PM
Hostname Question darkfnord Linux - Newbie 1 09-04-2003 08:27 PM
hostname question (urgent) dincer80 Linux - Networking 11 07-31-2003 08:01 AM

All times are GMT -5. The time now is 05:46 PM.

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