help with mysql connection problem please...

Discussion in 'Technical' started by shd0w, Mar 31, 2007.

  1. shd0w

    shd0w New Member

    I installed ispconfig on my ubuntu server using the perfect setup howto and it worked perfectly for several days then I tried to log into the control panel and got the following error
    Code:
    Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query in /home/admispconfig/ispconfig/lib/classes/ispconfig_db_mysql.lib.php on line 77
    
    Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query in /home/admispconfig/ispconfig/lib/classes/ispconfig_db_mysql.lib.php on line 77
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/admispconfig/ispconfig/lib/classes/ispconfig_db_mysql.lib.php:77) in /home/admispconfig/ispconfig/web/login/login.php on line 60
    I have had the following problem before and i just reformated i would like to avoid doing anything drastic this time lol any help regarding this would be very much appreciated
     
  2. Ben

    Ben Active Member Moderator

    Is mySQLD still running?
    Did you active the errorlog in your mysql to see if some errormessages are written there?
     
  3. Beastcave

    Beastcave New Member

    What's the commands?

    What is the commands for checking MySQL error or even a little how to set it up would be appreciated.

    Thanks
    B:)
     
  4. falko

    falko Super Moderator Howtoforge Staff

    You can enable the MySQL log in your my.cnf file (/etc/my.cnf or /etc/mysql/my.cnf). Restart MySQL afterwards.
     
  5. Beastcave

    Beastcave New Member

    COnnection Errors with MySQL

    Thanks Falko,

    I was able to turn on the error log in /var/log/mysql/mysql.log and read it after i restarted the MySQL. Now I still keep getting this error same as shd0w. This is my mysql error. I had to refresh my website several times before I was able to read it.

    Code:
    Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query in /home/admispconfig/ispconfig/lib/classes/ispconfig_db_mysql.lib.php on line 77
    
    Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query in /home/admispconfig/ispconfig/lib/classes/ispconfig_db_mysql.lib.php on line 77
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/admispconfig/ispconfig/lib/classes/ispconfig_db_mysql.lib.php:77) in /home/admispconfig/ispconfig/lib/classes/ispconfig_auth.lib.php on line 99
    This is what I kept getting this and I checked the error log that I turned on. I couldn't find any errors with the log. It just states the commands of opening db and then quitting. Can I have more information on how to resolve this? If you need to read my logs, let me know which one and I'll post them here.

    THanks!!
    B
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Can you post the output of
    Code:
    netstat -tap
    ?
     
  7. Beastcave

    Beastcave New Member

    Code:
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 *:mysql  *:*               LISTEN     14573/mysqld
    tcp        0      0 *:81      *:*               LISTEN     26842/ispconfig_htt
    tcp        0      0 servername.mydomain.com :domain *:*   LISTEN     914/named
    tcp        0      0 localhost.locald:domain *:*  LISTEN     914/named
    tcp        0      0 *:smtp                  *:*    LISTEN     1690/master
    tcp        0      0 localhost.localdoma:953 *:*    LISTEN     914/named
    tcp6       0      0 *:imaps                 *:*        LISTEN     3507/couriertcpd
    tcp6       0      0 *:pop3s                 *:*        LISTEN     3540/couriertcpd
    tcp6       0      0 *:pop3                  *:*        LISTEN     3519/couriertcpd
    tcp6       0      0 *:imap2                 *:*        LISTEN     3486/couriertcpd
    tcp6       0      0 *:www                   *:*       LISTEN     26944/apache2
    tcp6       0      0 *:ftp                   *:*          LISTEN     27903/proftpd: (acc
    tcp6       0      0 *:ssh                   *:*         LISTEN     3642/sshd
    tcp6       0      0 *:smtp                  *:*        LISTEN     1690/master
    tcp6       0      0 ip6-localhost:953       *:*     LISTEN     914/named
    tcp6       0      0 *:https                 *:*        LISTEN     26944/apache2
    tcp6       0      0 servername.mydomain.com :ssh ::ffff:192.168.0.2:1408 ESTABLISHED26954/sshd: adminis
    
    Thanks
    B
     
  8. falko

    falko Super Moderator Howtoforge Staff

    MySQL is running.
    Did you maybe update MySQL after ISPConfig was installed? Maybe the MYSQL client code compiled during ISPConfig installation isn't copmpatible with your new MySQL version.
    What's your MySQL version?
     
  9. Beastcave

    Beastcave New Member

    I don't think I updated my MySQL. I followed exact what your how-to "The Perfect Setup - Unbuntu 6.10 Server" including the comments.

    Code:
    mysql  Ver 14.12 Distrib 5.0.24a, for pc-linux-gnu (i486) using readline 5.1
    
    Connection id:          880
    Current database:
    Current user:           root@localhost
    SSL:                    Not in use
    Current pager:          stdout
    Using outfile:          ''
    Using delimiter:        ;
    Server version:         5.0.24a-Debian_9ubuntu2-log
    Protocol version:       10
    Connection:             Localhost via UNIX socket
    Server characterset:    latin1
    Db     characterset:    latin1
    Client characterset:    latin1
    Conn.  characterset:    latin1
    UNIX socket:            /var/run/mysqld/mysqld.sock
    Uptime:                 2 days 8 hours 4 min 54 sec
    
    Threads: 1  Questions: 9948  Slow queries: 7  Opens: 190  Flush tables: 1  Open tables: 54  Queries per second avg: 0.049
    
    B
     
  10. falko

    falko Super Moderator Howtoforge Staff

    I see some Slow queries in your output. Usually this is a sign that MySQL needs to be optimized. Do you have a high server load?
     
  11. Beastcave

    Beastcave New Member

    Code:
    Optimize: ispconfigdb.login	 status: Table is already up to date
    Optimize: ispconfigdb.multidoc_dep	status: Table is already up to date
    Optimize: ispconfigdb.multidoc_nodes	status: Table is already up to date
    Optimize: ispconfigdb.session	status: OK
    Optimize: ispconfigdb.sys_config	status: Table is already up to date
    Optimize: ispconfigdb.sys_dep	status: Table is already up to date
    Optimize: ispconfigdb.sys_modules	status: Table is already up to date
    Optimize: ispconfigdb.sys_news	status: Table is already up to date
    Optimize: ispconfigdb.sys_nodes	status: OK
    Optimize: ispconfigdb.sys_user	status: Table is already up to date
    Optimize: ispconfigdb.user_groups	status: Table is already up to date
    I did optimize my database and it is still the same. I just started this domain/server and I don't think it's being used by public yet.

    Posted what my ispconfig status says:
    Code:
    Server Online since:  	
    6d, 4:51h
    Users Online: 	
    1 user (That's me :cool: )
    System Load 1 Minute: 	
    0.05
    System Load 5 Minutes: 	
    0.03
    System Load 15 Minutes: 	
    0.00
    Filesystem	Size	Used	Avail	Use%	Mounted
    /dev/hda1	7.4G	1.1G	6.1G	15%	/
    varrun	125M	88K	125M	1%	/var/run
    varlock	125M	0	125M	0%	/var/lock
    procbususb	10M	52K	10M	1%	/proc/bus/usb
    udev	10M	52K	10M	1%	/dev
    devshm	125M	0	125M	0%	/dev/shm
    Anything else ya wanna to know or something I should check?

    B
     
  12. Beastcave

    Beastcave New Member

    Not sure if it helps.I did enable the log for mysql_slow.log

    here what it says:
    Code:
    /usr/sbin/mysqld, Version: 5.0.24a-Debian_9ubuntu2-log. started with:
    Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
    Time                 Id Command    Argument
    # Time: 070624  6:25:26
    # User@Host: debian-sys-maint[debian-sys-maint] @ localhost []
    # Query_time: 4294967287  Lock_time: 0  Rows_sent: 0  Rows_examined: 0
    SET timestamp=1182680726;
    # administrator command: Refresh;
    
    B
     
  13. falko

    falko Super Moderator Howtoforge Staff

  14. Beastcave

    Beastcave New Member

    Wow lots of information to absorb and I'm not sure where to start. I'll put in the slow queries log in this and maybe you'll be able to identify which path I should take to optimize my server. There are many ways to optimize server and I'm not sure which one I should do.
    Code:
    /usr/sbin/mysqld, Version: 5.0.24a-Debian_9ubuntu2-log. started with:
    Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
    Time                 Id Command    Argument
    /usr/sbin/mysqld, Version: 5.0.24a-Debian_9ubuntu2-log. started with:
    Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
    Time                 Id Command    Argument
    # Time: 070627 21:26:03
    # User@Host: root[root] @ servername.mydomain.com [192.168.0.100]
    # Query_time: 4294967295  Lock_time: 0  Rows_sent: 1  Rows_examined: 3
    use ispconfigdb;
    SELECT * from user_groups where groupid = '1' and userid = '1' and userstatus = '1';
    # Time: 070627 21:26:04
    # User@Host: root[root] @ servername.mydomain.com [192.168.0.100]
    # Query_time: 4294967295  Lock_time: 0  Rows_sent: 1  Rows_examined: 0
    SELECT * from doctype where doctype_id = '1021';
    # Time: 070627 21:26:13
    # User@Host: root[root] @ servername.mydomain.com [192.168.0.100]
    # Query_time: 4294967288  Lock_time: 0  Rows_sent: 1  Rows_examined: 0
    SELECT * from doctype where doctype_id = '1013';
    # Time: 070627 21:26:16
    # User@Host: root[root] @ servername.mydomain.com [192.168.0.100]
    # Query_time: 4294967290  Lock_time: 0  Rows_sent: 1  Rows_examined: 6
    SELECT * from isp_nodes , isp_dep , isp_isp_user where isp_isp_user.doc_id = isp_nodes.doc_id and isp_isp_user.doctype_id = isp_nodes.doctype_id and isp_isp_user.doc_id = isp_dep.child_doc_id and isp_dep.child_doctype_id = 1014 and isp_nodes.status = '1' and isp_dep.parent_tree_id = 8;
    
    So what should I do? Change the key_buffer_size or anything like this?
    My server's PII 333MHz Dual with 256MB Ram... Not sure if helps with this

    (Just tell me that my server's too friggin' slow and I'll convince my wife to get me a faster one :D )

    B
     
  15. falko

    falko Super Moderator Howtoforge Staff

    It's not the fastest one... ;)
    You can try to change the buffer and cache settings for MySQL, like key_buffer, sort_buffer_size, read_buffer_size, read_rnd_buffer_size, myisam_sort_buffer_size, query_cache_limit, query_cache_size, etc.
     

Share This Page