LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   MySql throwing connection error (https://www.linuxquestions.org/questions/linux-server-73/mysql-throwing-connection-error-606224/)

mystic_durle12 12-22-2007 01:33 AM

here are the messages that i get when i try to run the server daemon manually. there is some problem with hostname or something. can anyone plz tell me about it

[root@localhost ~]# /etc/rc.d/init.d/mysqld start
Initializing MySQL database: Neither host 'localhost.localdomain' nor 'localhos t' could be looked up with
/usr/bin/resolveip
Please configure the 'hostname' command to return a correct hostname.
If you want to solve this at a later stage, restart this script with
the --force option
[FAILED]

kzutter 12-23-2007 12:17 AM

I am really concerned about that space character in "localhos t".

Post the results of these two commands:

hostname

cat /etc/hosts

Like this:

Code:

ken@u2:~$ hostname
u2
ken@u2:~$ cat /etc/hosts
127.0.0.1      localhost
192.168.1.2    u2.bonanza.lan  u2

192.168.1.4 ulaptop ulaptop.bonanza.lan
192.168.1.3 venus venus.bonanza.lan

# The following lines are desirable for IPv6 capable hosts
::1    ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts


mystic_durle12 12-23-2007 05:22 AM

Here it is .
[root@localhost ~]# hostname
localhost.localdomain


[root@localhost ~]# cat /etc/hosts
[root@localhost ~]#

Note: space between the output of these two commands is for clarity only. its not the part of the output

kzutter 12-24-2007 10:09 AM

Quote:

Originally Posted by mystic_durle12 (Post 2999516)
Here it is .
[root@localhost ~]# hostname
localhost.localdomain


[root@localhost ~]# cat /etc/hosts
[root@localhost ~]#

Note: space between the output of these two commands is for clarity only. its not the part of the output

Looks like you have an empty hosts file and that you never gave the machine its own hostname (perhaps the installer suggested localhost.localdomain and you accepted that).

As, root edit /etc/hosts and add this line:
Code:

127.0.0.1 localhost localhost.localdomain
Save the file, then as root, execute this command:
Code:

hostname localhost
See if it works now, restart mysql and try to log in to it.

mystic_durle12 12-25-2007 08:18 AM

it is working. First i stopped it and then started it again and its working.
the following command tells me that its working.thanx to u. :)

[root@localhost ~]# chkconfig --list|grep mysqld
mysqld 0: off 1: off 2: off 3: on 4: off 5: on 6: off

but when i try to connect to it, it fails. how can i reset all the passwords previously set.

[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N O)
[root@localhost ~]# mysql -u root -password userprime
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

and one thing more. how can i get the GUI for Mysql installed. should i get the source or the rmps from mysql site and build it?

kzutter 12-25-2007 10:39 PM

Quote:

Originally Posted by mystic_durle12 (Post 3001132)
---snip---
[root@localhost ~]# mysql -u root -password userprime

you may be using the password option incorrectly, try this:
NOTE: there is no space between the -p and the password - run it together
Code:

mysql -u root -puserprime
As for a GUI, the only thing I bother with is phpMyAdmin. But it requires that you have a web server with php.

Whether you build from source or use rpm packages, you must be aware that you are purposely running outdated software.

mystic_durle12 12-31-2007 06:20 AM

it is not working.I have gui tools installed and they give the same error message. Is there any way that i reset the passwords without knowing the original password.

Deleriux 12-31-2007 07:08 AM

Code:

/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables &
mysql -uroot <<<'update mysql.user set Password=password("mynewpasshere") where User="root" and Host="localhost"'
mysqladmin shutdown
/etc/init.d/mysqld start

That should do the trick.

mystic_durle12 01-01-2008 09:56 PM

it worked. Deleriux thanx a lot fellow. that was really helpful.Thank u all who contributed to my message.


All times are GMT -5. The time now is 07:24 AM.