Ad Widget

Collapse

Please help this noob with mysql error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AdamBomb
    Junior Member
    • Jan 2007
    • 1

    #1

    Please help this noob with mysql error

    I am running Ubuntu Edgy Eft and installed Zabbix using synaptic. Currently when I try to access the frontend of zabbix I get the following:

    Warning: mysql_pconnect() [function.mysql-pconnect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /usr/share/zabbix/include/db.inc.php on line 32

    Warning: mysql_select_db() [function.mysql-select-db]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /usr/share/zabbix/include/db.inc.php on line 33

    Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /usr/share/zabbix/include/db.inc.php on line 33
    Error connecting to database [Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)]

    I have no idea what to do about this error message (as I am a linux noob), and would appreciate some help.
  • alj
    Senior Member
    • Aug 2006
    • 188

    #2
    Originally posted by AdamBomb
    I am running Ubuntu Edgy Eft and installed Zabbix using synaptic. Currently when I try to access the frontend of zabbix I get the following:

    Warning: mysql_pconnect() [function.mysql-pconnect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /usr/share/zabbix/include/db.inc.php on line 32

    Warning: mysql_select_db() [function.mysql-select-db]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /usr/share/zabbix/include/db.inc.php on line 33

    Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /usr/share/zabbix/include/db.inc.php on line 33
    Error connecting to database [Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)]

    I have no idea what to do about this error message (as I am a linux noob), and would appreciate some help.

    Either mysql is not running or mysql socket is in different place. (path for socket is different in my.cnf and in zabbix_server.conf)

    Comment

    • ZBox
      Junior Member
      • Jan 2007
      • 8

      #3
      Hi !

      I've the same problem...

      AdamBomb, the first who finds the problem post here, right??

      It is many days that I try, but I did not find anything for the errors...



      Z

      Comment

      • ZBox
        Junior Member
        • Jan 2007
        • 8

        #4
        alj the file "/var/run/mysqld/mysqld.sock" does not exist...

        I don't understand why... I've follow the installation tutorial step by step...

        any idea?

        thanks to all

        Z

        Comment

        • jsimoes
          Junior Member
          • Dec 2006
          • 10

          #5
          is mysqld running?

          Comment

          • ZBox
            Junior Member
            • Jan 2007
            • 8

            #6
            yes ...

            and I recompile it just now... same error...



            Z

            thank jsimoes

            Comment

            • ZBox
              Junior Member
              • Jan 2007
              • 8

              #7
              other suggest??

              Comment

              • visionbix
                Junior Member
                • Dec 2006
                • 10

                #8
                db.inc.php

                // DATABASE CONFIGURATION

                // $DB_TYPE ="ORACLE";
                // $DB_TYPE ="POSTGRESQL";
                $DB_TYPE ="MYSQL";
                $DB_SERVER ="127.0.0.1";
                $DB_DATABASE ="zabbix";
                $DB_USER ="root";
                $DB_PASSWORD ="";

                Comment

                • ZBox
                  Junior Member
                  • Jan 2007
                  • 8

                  #9


                  visionbix I obtain the same error...

                  at the start of my db.inc.php:

                  // DATABASE CONFIGURATION
                  include_once("/etc/zabbix/dbconfig.php");
                  // END OF DATABASE CONFIGURATION

                  and the file "/etc/zabbix/dbconfig.php" is:

                  <?
                  $DB_TYPE='MYSQL';
                  $DB_SERVER='127.0.0.1';
                  $DB_DATABASE='zabbix';
                  $DB_USER='root';
                  $DB_PASSWORD='';
                  ?>

                  but the error is the same:

                  Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for
                  user 'root'@'localhost' (using password: NO) in /usr/share/zabbix/include/db.inc.php on line 32

                  Warning: mysql_select_db() [function.mysql-select-db]: Access denied
                  for user 'www-data'@'localhost' (using password: NO) in
                  /usr/share/zabbix/include/db.inc.php on line 33

                  Warning: mysql_select_db() [function.mysql-select-db]: A link to the
                  server could not be established in
                  /usr/share/zabbix/include/db.inc.php on line 33
                  Error connecting to database [Access denied for user
                  'www-data'@'localhost' (using password: NO)]




                  thank you anyway....

                  Comment

                  • ZBox
                    Junior Member
                    • Jan 2007
                    • 8

                    #10
                    Anybody has another suggests??

                    please...

                    Comment

                    • Heva
                      Junior Member
                      • Dec 2006
                      • 15

                      #11
                      Did you check file permissions/ownership?

                      Comment

                      • napel25
                        Junior Member
                        • Nov 2006
                        • 18

                        #12
                        The error says:
                        www-data'@'localhost can't login

                        The config file has a root username.

                        Are you using the proper configuration file?

                        The web server is prob not running on the root account.

                        Comment

                        • ZBox
                          Junior Member
                          • Jan 2007
                          • 8

                          #13
                          I've repeat the procedure just now...

                          Code:
                          groupadd zabbix
                          useradd -c 'Zabbix' -d /home/zabbix -g zabbix -s /bin/bash zabbix
                          mkdir /home/zabbix
                          chown -R zabbix.zabbix /home/zabbix
                          cd /home/zabbix
                          tar zxvpf zabbix-1.1beta8.tar.gz
                          mv zabbix-1.1beta7 zabbix
                          cd zabbix
                          chown -R zabbix.zabbix .
                          su - zabbix
                          but when I try to create mysql database I obtain the same error message:

                          Code:
                          zabbix$ mysql -p -u root
                          Enter password:
                          ERROR 2002 (HY000): Can't connect to local MySQL server through socket
                          '/var/run/mysqld/mysqld.sock' (2)
                          What's wrong? the error is in the mysql socket?

                          thanks

                          Z

                          Comment

                          • peacestgt
                            Junior Member
                            • Jan 2007
                            • 17

                            #14
                            if you have debian and the system is "new" and you can drop all databases...

                            1. stop mysql
                            2. remove var/lib/mysql/mysql
                            3. mysql_install_db
                            4. restart mysql
                            5. change the root password for mysql

                            otherwise
                            1. stop mysql
                            2. make a backup from /var/lib/mysql/mysql
                            3. remove /var/lib/mysql/mysql
                            4. restart mysql or try to star mysql in safe mode

                            what happen is you delete the mysql sock or the mysqltable is "crached"

                            regards

                            mike

                            Comment

                            • antoa315
                              Junior Member
                              • Jan 2007
                              • 1

                              #15
                              Similar mysql issue

                              I am having a similar issue.

                              I am running fedora core 4 and mysql 5.0.33

                              mysql socket is set to /tmp/mysql.sock in both my my.cnf as well as my zabbix_server.conf, but I am receiving the following error when trying to access the web interface:

                              Error connecting to database [Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)]

                              I am confused as to why it is looking for the socket at /var/lib/mysql/mysql.sock

                              MySQL is up an running fine, I am able to log in with the username and pw I specified in the db.inc.php file.

                              I even tried changing the socket to /var/lib/mysql/mysql.sock, but still received the same message.

                              Any suggestions?

                              Comment

                              Working...