'How to connect to MySQL using PuTTy' doesn't work

Discussion in 'HOWTO-Related Questions' started by kuriharu, Jan 3, 2007.

  1. kuriharu

    kuriharu New Member

    I followed the instructions to a T, but it doesn't work. I have it set so root can't connect to anything but localhost and it still doesn't work. I've tried the internal IP, 127.0.0.1, localhost, etc, but no dice.

    Oh well, it seemed like a cool idea at the time.
     
  2. falko

    falko Super Moderator ISPConfig Developer

    What's the output of
    Code:
    netstat -tap
    and
    Code:
    ps aux|grep -i mysql
    ?
     
  3. kuriharu

    kuriharu New Member

    ps aux won't work -- On Windows

    Thanks for getting back to me, Falco.

    ps aux won't work, as I'm running PuTTy and MySQL admin on Windows.

    I managed to get it to work partially -- I created a "Grant all on *.* to 'root'@'localhost.localdomain'; on the MySQL server, and now I can log in with a blank password using this method. Being on the server still requires the root password to access MySQL, so I'm not too worried about security for the moment. For some reason, adding a password to root@localhost.localdomain didn't work -- it still logs me in with a blank password.

    When MySQL admin does run, however, it lets me see my databases but I can't change anything. I get an error that says "Either the server service or the configuration file could not be found. Startup variables and server are therefore disabled." I haven't Googled this one, yet.

    Thanks again for getting back to me.
     
  4. kuriharu

    kuriharu New Member

    Sorry, I meant "Falko". My bad!

    I was so happy to get a reply I forgot to spell your name properly. Sorry.
     
  5. falko

    falko Super Moderator ISPConfig Developer

    But your MySQL server is running on Linux, isn't it? Then connect to your Linux system with PuTTY (port 22 - SSH) and run
    Code:
    netstat -tap
    and
    Code:
    ps aux|grep -i mysql
     
  6. kuriharu

    kuriharu New Member

    Oh yeah. Whoops!

    Thanks for getting back to me.

    Here is the output of netstat -tap:

    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 *:wnn6 *:* LISTEN 1982/jserver
    tcp 0 0 *:swat *:* LISTEN 1987/inetd
    tcp 0 0 *:mysql *:* LISTEN 2040/mysqld
    tcp 0 0 *:netbios-ssn *:* LISTEN 2088/smbd
    tcp 0 0 *:pop3 *:* LISTEN 1987/inetd
    tcp 0 0 localhost.localdo:spamd *:* LISTEN 1934/spamd.pid
    tcp 0 0 *:sunrpc *:* LISTEN 1626/portmap
    tcp 0 0 *:www *:* LISTEN 16742/apache2
    tcp 0 0 *:canna *:* LISTEN 1946/cannaserver
    tcp 0 0 *:auth *:* LISTEN 1987/inetd
    tcp 0 0 *:munin *:* LISTEN 2128/munin-node
    tcp 0 0 *:ftp *:* LISTEN 1987/inetd
    tcp 0 0 *:ssh *:* LISTEN 2103/sshd
    tcp 0 0 localhost.localdom:smtp *:* LISTEN 1977/exim4
    tcp 0 0 mail.<name withheld>:smtp *:* LISTEN 1977/exim4
    tcp 0 0 *:https *:* LISTEN 16742/apache2
    tcp 0 0 *:2812 *:* LISTEN 29878/monit
    tcp 0 0 *:microsoft-ds *:* LISTEN 2088/smbd
    tcp 0 0 mail.<name withheld>:pop3 mail.<name withheld>:2260 TIME_WAIT -
    tcp 0 0 mail.<name withheld>:mysql mail.<name withheld>:40330 ESTABLISHED2040/mysqld
    tcp 0 0 mail.<name withheld>:mysql mail.<name withheld>:40331 TIME_WAIT -
    tcp 0 0 mail.<name withheld>:www lj602239.inktomis:44796 TIME_WAIT -
    tcp 0 52 mail.<name withheld>:ssh mail.<name withheld>:2828 ESTABLISHED3900/sshd: <name withheld> [
    tcp 0 0 mail.<name withheld>:40330 mail.<name withheld>:mysql ESTABLISHED3903/0

    Here is the output for ps aux| grep -i mysql

    root 2006 0.0 0.3 2508 1236 ? S Jan01 0:00 /bin/sh /usr/bin/mysqld_safe
    mysql 2040 0.0 5.7 119640 18636 ? S Jan01 0:02 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
    root 2041 0.0 0.1 1488 500 ? S Jan01 0:00 logger -p daemon.err -t mysqld_safe -i -t mysqld
    root 4296 0.0 0.1 1552 528 pts/0 S+ 08:13 0:00 grep -i mysql
     
  7. falko

    falko Super Moderator ISPConfig Developer

    Looks ok.
    What's the output of
    Code:
    mysql -h localhost -u root -p
    and
    Code:
    mysql -h 127.0.0.1 -u root -p
    ?
    What's the output of
    Code:
    ifconfig
    and what's in /etc/hosts?
     
  8. kuriharu

    kuriharu New Member

    Here you go:

    The first two worked fine with my regular root password for MySQL

    Ifconfig:
    --------------------------
    eth0 Link encap:Ethernet HWaddr 00:50:DA:7C:1F:06
    inet addr:192.168.X.XXX Bcast:192.168.X.XXX Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:883347 errors:0 dropped:0 overruns:0 frame:0
    TX packets:350871 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:354650083 (338.2 MiB) TX bytes:95787104 (91.3 MiB)
    Interrupt:5 Base address:0x1000

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:670953 errors:0 dropped:0 overruns:0 frame:0
    TX packets:670953 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:75728099 (72.2 MiB) TX bytes:75728099 (72.2 MiB)


    In /etc/hosts, this is what I have:
    ----------------------------
    192.168.X.XXX <local machine name>
    127.0.0.1 localhost.localdomain localhost

    192.168.X.XXX <one Windows PC>
    192.168.X.XXX <Another Windows PC>

    # 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
     
  9. falko

    falko Super Moderator ISPConfig Developer

    This looks fine, so the tutorial should work. Please compare your settings again with those from the tutorial.
     
  10. spineb

    spineb New Member

    Issues making connection as with certain hosts

    Hi falko,

    I too followed the instructions in the 'How to connect to MySQL using PuTTy' tutorial and can not get the connection to work.

    The problem has something to do with my hosting provider as I was able to make a successful connection to my dedicated server.

    When I tried to connect to my shared hosting DB I receive "MySQL Error Number 2013. Lost connection to MySQL server during query".

    What I'm wondering is if there is anyway to specify what host name I want to connect to on the remote server as each database on my hosted server has its own unique Host Name.

    Thanks for any incite.

    -Bryan
     
  11. falko

    falko Super Moderator ISPConfig Developer

    You can do it like this:
    Code:
    mysql -h [I]hostname[/I] -u [I]username[/I] -p
     
  12. spineb

    spineb New Member

    Thanks for the response. Where exactly do I enter the mysql command?

    I can log into MySQL from in Putty using the command that you gave me but still receive the same error when I try to log in with the MySQL Administrator.

    I also tried using that same command in the username field in MySQL Administrator, hoping to get some different response. Neither seem to do anything, is there an extra field in the MySQL Administrator that I am missing to add additional login queries?

    Thanks again.
     
  13. falko

    falko Super Moderator ISPConfig Developer

    On the command line (e.g. in PuTTY).

    This means the user and password are correct.

    Seems to be a misconfiguration of MySQL Administrator...
     
  14. czarkhan

    czarkhan New Member

    hi falko

    I am new memeber on your forums.

    Through google i came across your post 'How to connect to MySQL using PuTTy' and i have the same problem/query.

    I can see that you have referred to see some tutorial but i am not able to find that tutorial.

    Can you please send me link to that tutorial where i can know how to connect MySQL database project using putty client server program.

    Thanks in advance

    Saif
     
  15. falko

    falko Super Moderator ISPConfig Developer

    I don't know such a tutorial. What exactly are you trying to do?
     
  16. czarkhan

    czarkhan New Member

    I working on my term project and have few doubts

    1. I dont know how to make a connection between server program and MySQL using putty

    2. Can putty be installed and run on linux??

    Thanks
     
  17. falko

    falko Super Moderator ISPConfig Developer

    Log in to your server with SSH, and then run
    Code:
    mysql -u root -p
    to connect to MySQL.

    Yes, but it's easier to use the terminal which is installed anyway.
     

Share This Page