Ad Widget

Collapse

Problem with creating database schema

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dakkonz
    Junior Member
    • Oct 2005
    • 20

    #1

    Problem with creating database schema

    hi guys,
    can anyone help me?
    I trying to insert the database schema and the intial data values into the database....

    from the manual i am suppose to run
    cat schema.sql \mysql -u <username> -p <password> zabbix

    for my case... once logged in as my user acct
    I run
    cat zabbix-1.0/create/mysql/schema.sql /usr/local/mysql/bin/mysql -u <username> zabbix

    But the schema does not get into the databases

    I have already granted all privileges to Mysql username and there is no password for Mysql login
    The way i connect to mysql is 1) once logged in I will key
    cd /usr/local/mysql/bin
    then i will type
    ./mysql -u <username>
    to enter to sql....

    Think there is something wrong with my path for sql connection... can anyone help me solve this???

    Thanks
  • krusty
    Senior Member
    • Oct 2005
    • 222

    #2
    Hi, do something like that:

    Code:
    cat zabbix-1.0/create/mysql/schema.sql |mysql -u <username> zabbix
    or if you have set password
    Code:
    cat zabbix-1.0/create/mysql/schema.sql |mysql -u <username> -p<password> zabbix
    This works fine.

    Greez
    Last edited by krusty; 24-11-2005, 13:14.

    Comment

    • dakkonz
      Junior Member
      • Oct 2005
      • 20

      #3
      Erm it still cant work.
      I got the error
      -bash: mysql: command not found

      Comment

      • krusty
        Senior Member
        • Oct 2005
        • 222

        #4
        enter the console the following command

        Code:
        which mysql
        now you know the path to mysql.

        What happens if you type into the console mysql -u <user> -p <password> zabbix
        Can you enter mysql?

        Comment

        • krusty
          Senior Member
          • Oct 2005
          • 222

          #5
          which distribution or better which os you use?

          Comment

          • dakkonz
            Junior Member
            • Oct 2005
            • 20

            #6
            [weekiat@samba ~]$ which mysql
            /usr/bin/which: no mysql in (/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/weekiat/bin)

            this is wat i got from keying in which mysql

            Comment

            • krusty
              Senior Member
              • Oct 2005
              • 222

              #7
              Originally posted by dakkonz
              [weekiat@samba ~]$ which mysql
              /usr/bin/which: no mysql in (/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/weekiat/bin)

              this is wat i got from keying in which mysql
              ok, i think your installation of mysql was wrong. do you install mysql with os? If you install mysql after os do you use rpm or src Code for installation? Which os do you use?
              Maybe you can link mysql manual. Let me look.

              Comment

              • Landstalker
                Junior Member
                • Nov 2005
                • 3

                #8
                mysql is not in your path so you can't just execute it.

                do find -name mysql and it should present you with where its installed to. Probably something like /usr/local/bin/ or something like that.

                Then where it says |mysql in the above command, just insert the full location just after the pipe ( | ).

                Try that.

                Comment

                • krusty
                  Senior Member
                  • Oct 2005
                  • 222

                  #9
                  Code:
                  cat zabbix-1.0/create/mysql/schema.sql |/usr/local/mysql/bin/mysql -u <username> zabbix
                  ok, maybe this works

                  try it

                  Comment

                  • dakkonz
                    Junior Member
                    • Oct 2005
                    • 20

                    #10
                    hmm tried it... but it seems not all tables are created...
                    only slightly more than half.....shall go and check what is wrong with the MYSQL code at that point

                    Thanks a lot guys.....
                    Great Help

                    Comment

                    • krusty
                      Senior Member
                      • Oct 2005
                      • 222

                      #11
                      you should have 42 tables in zabbix database.

                      Comment

                      • dakkonz
                        Junior Member
                        • Oct 2005
                        • 20

                        #12
                        hmmm i only got the following in the database
                        | actions |
                        | alarms |
                        | alerts |
                        | config |
                        | functions |
                        | graphs |
                        | graphs_items |
                        | groups |
                        | history |
                        | history_str |
                        | hosts |
                        | hosts_groups |
                        | items |
                        | media |
                        | media_type |
                        | services |
                        | services_links |
                        | sessions |
                        | sysmaps |
                        | sysmaps_hosts |
                        | sysmaps_links |
                        | trigger_depends |
                        | triggers |
                        | users |

                        and i have counted the tables in the schema.sql it only adds up to 33 tables
                        I am using the zabbix-1.0 stable version

                        Comment

                        • dakkonz
                          Junior Member
                          • Oct 2005
                          • 20

                          #13
                          I manage to create the database already... but it only contains 33 tables.
                          There appears to be a problem in the schema.sql file
                          CREATE TABLE rights (
                          rightid int(4) NOT NULL auto_increment,
                          userid int(4) DEFAULT '0' NOT NULL,
                          name char(255) DEFAULT '' NOT NULL,
                          permission char(1) DEFAULT '' NOT NULL,
                          id int(4),
                          PRIMARY KEY (rightid)
                          ) type=InnoDB;

                          I added in the 0 for the userid default value and my schema.sql gets added in into mysql without any error.

                          Comment

                          • dakkonz
                            Junior Member
                            • Oct 2005
                            • 20

                            #14
                            I have proceeded in the installation till run server process
                            but i got an error when trying to run suckerd and trapperd

                            ./zabbix_suckerd: error while loading shared libraries: libmysqlclient.so.15: cannot open shared object file: No such file or directory

                            can anyone guide me how to solve this?
                            Thanks

                            Comment

                            • krusty
                              Senior Member
                              • Oct 2005
                              • 222

                              #15
                              Originally posted by dakkonz
                              I manage to create the database already... but it only contains 33 tables.
                              There appears to be a problem in the schema.sql file
                              CREATE TABLE rights (
                              rightid int(4) NOT NULL auto_increment,
                              userid int(4) DEFAULT '0' NOT NULL,
                              name char(255) DEFAULT '' NOT NULL,
                              permission char(1) DEFAULT '' NOT NULL,
                              id int(4),
                              PRIMARY KEY (rightid)
                              ) type=InnoDB;

                              I added in the 0 for the userid default value and my schema.sql gets added in into mysql without any error.
                              Ok, I use the 1.1beta and I had 42 tables. Maybe the stable version has only 33 Tables. I don“t know. I never installed the stable version.

                              Comment

                              Working...