Zugriff auf die Datenbanken???

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Zugriff auf die Datenbanken???

    Hallo Leute

    Da ich neu hier bin, möchte ich euch ganz herzlich begrüssen
    mein problem ist, auf die datenbanken, die ich erstellt habe abzufragen!
    mit der folgenden Statement habe ich versucht auf die db zuzugreifen, was leider nicht gefunkt hat:

    PHP-Code:
    <?php
    $dbx 
    = @mysql_connect("localhost""xxxxxxx""xxxxxxx");
    if (!
    $dbx) {
    echo(
    "Can not connect to database");
    exit();
    }
    if (!
    mysql_select_db("Jokes")) {
    echo(
    "Can not connect to databases");
    exit();
    }
    ?>
    <?php
    $result 
    = @mysql_query("SELECT JokeText FROM Jokes");
    if (!
    $result) {
    echo(
    "<p>Fehler bei der Ausf&uuml;hrung der Abfrage: " mysql_error() . "</p>");
    exit();
    }
    // Text jedes Witzes in einem Absatz anzeigen
    while ( $row mysql_fetch_array($result) ) {
    echo(
    "<p>" $row["JokeText"] . "</p>");
    }
    ?>
    Natürlich habe ich auch die daten sprich user und Passwort die ich unter my.ini MySqladmin gespeichert habe benutzt. Oder muss ich einen neuen user erstellen? wenn ja, wie geht das? es kommt immer wieder die meldung, das ich keine berechtigung habe auf die server zuzugreifen!

    HAbe es unter Win2000 installiert!
    Apache 2.0.4.5 - PHP4.3.1 und mysql-4.0.12
    auch ssl und perl habe ich auf mein localhost installiert!

    kann vieleicht einer von euch mir helfen?

    danke schonmal!

    Gruss
    TP
    Zuletzt geändert von Abraxax; 07.05.2003, 14:15.


    Wer Liebe gibt, kriegt auch Liebe zurück. Daher hasse ich PHP ;-)

  • #2
    wie wäre es, wenn du die php-tags verwendest. ich habe sie mal eingefügt.

    dann solltest du dir auch mal die grundkenntnisse zum connect an die db ansehen. siehe link in meiner sig.

    und das hier sollte funktionieren.
    PHP-Code:
    <?php
      
        mysql_connect
    ("localhost""xxxxxxx""xxxxxxx") or die("Can't connect to db-server");
        
    mysql_select_db("Jokes") or die("Can't select database");

        
    $result mysql_query("SELECT JokeText FROM Jokes") or die(mysql_error());

        while ( 
    $zeile mysql_fetch_assoc($result) )
        {
            echo 
    "<p>" $zeile["JokeText"] . "</p>" ;
        }

    ?>
    INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


    Kommentar


    • #3
      hallo Abraxax

      ich habe die grundkenntnisse was connect angeht in verschiedenen büchern wie das vom kevin yank oder aber auch "programmieren mit PHP" vom Rasmus Lerdorf&Kevin Tatroe verlag O'REILLY X-mal angesehen aber leider keinen lösung gefunden!

      Dannoch dank ich dir für den vorschlag und werd es gleich aussprobieren und dann sag ich dir den resultat

      Gruss
      TP


      Wer Liebe gibt, kriegt auch Liebe zurück. Daher hasse ich PHP ;-)

      Kommentar


      • #4
        Nein es geht leider wieder nicht!

        Die folgender fehler meldung ist wieder angezeigt wurden!

        Warning: mysql_connect() [function.mysql-connect]: Keine Zugriffsberechtigung für Benutzer: 'xxxxxx@127.0.0.1'. (Verwendetes Passwort: Ja) in E:\MyServer\MyWeb\MyPHP\php_db.php on line 9
        Can't connect to db-server

        Was mache ich bloss falsch???



        Wer Liebe gibt, kriegt auch Liebe zurück. Daher hasse ich PHP ;-)

        Kommentar


        • #5
          Original geschrieben von -=Taipan=-
          Was mache ich bloss falsch???
          du hast die falschen zugangsdaten. das steht doch da!

          Keine Zugriffsberechtigung für Benutzer: 'xxxxxx@127.0.0.1'.
          INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


          Kommentar


          • #6
            Ja aber welche zugangsdaten wird hier verlangt???
            sind es nicht die ich unter my.ini als admin gespeichert habe???

            # Example mysql config file.
            # Copy this file to c:\my.cnf to set global options
            #
            # One can use all long options that the program supports.
            # Run the program with --help to get a list of available options

            # This will be passed to all mysql clients
            [client]
            #password=my_password
            port=3306
            #socket=MySQL

            # Here is entries for some specific programs
            # The following values assume you have at least 32M ram

            [mysqld]
            basedir=E:/MySQL
            bind-address=127.0.0.1
            datadir=E:/MySQL/data
            language=E:/MySQL/share/german
            #slow query log#=
            #tmpdir#=
            #port=3306
            #set-variable=key_buffer=16M

            # The MySQL server
            [mysqld]
            port=3306
            #socket=MySQL
            skip-locking
            set-variable = key_buffer=256M
            set-variable = max_allowed_packet=1M
            set-variable = table_cache=256
            set-variable = sort_buffer=1M
            set-variable = record_buffer=1M
            set-variable = myisam_sort_buffer_size=64M
            set-variable = thread_cache=8
            # Try number of CPU's*2 for thread_concurrency
            set-variable = thread_concurrency=8
            server-id = 1

            # Uncomment the following if you want to log updates
            #log-bin

            # Uncomment the following if you are NOT using BDB tables
            #skip-bdb

            # Uncomment the following if you are using BDB tables
            #set-variable = bdb_cache_size=384M
            #set-variable = bdb_max_lock=100000

            # Uncomment the following if you are using Innobase tables
            #innodb_data_file_path = ibdata1:250M;ibdata2:250M
            #innodb_data_home_dir = e:\mysql\ibdata
            #innodb_log_group_home_dir = e:\mysql\iblogs
            #innodb_log_arch_dir = e:\mysql\iblogs
            #set-variable = innodb_mirrored_log_groups=1
            #set-variable = innodb_log_files_in_group=3
            #set-variable = innodb_log_file_size=10M
            #set-variable = innodb_log_buffer_size=5M
            #innodb_flush_log_at_trx_commit=1
            #innodb_log_archive=0
            #set-variable = innodb_buffer_pool_size=80M
            #set-variable = innodb_additional_mem_pool_size=10M
            #set-variable = innodb_file_io_threads=4
            #set-variable = innodb_lock_wait_timeout=50

            [mysqldump]
            quick
            set-variable = max_allowed_packet=16M

            [mysql]
            no-auto-rehash
            # Remove the next comment character if you are not familiar with SQL
            #safe-updates

            [isamchk]
            set-variable = key_buffer=8M
            set-variable = sort_buffer=8M

            [myisamchk]
            set-variable = key_buffer=8M
            set-variable = sort_buffer=8M

            [mysqlhotcopy]
            interactive-timeout

            [WinMySQLadmin]
            Server=E:/MySQL/bin/mysqld-max-nt.exe
            [COLOR=red]user=xxxxxxx[/COLOR]
            [COLOR=red]password=xxxxxxx[/COLOR]


            Wer Liebe gibt, kriegt auch Liebe zurück. Daher hasse ich PHP ;-)

            Kommentar


            • #7
              hast du phpmyadmin bei dir drauf? da stehen die in der config-datei drin.

              ich habe nur linux und da stehen keine pws in irgendeiner conf-datei, wie es hier bei dir der fall ist.
              INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


              Kommentar


              • #8
                hi

                ja ich habe phpmyadmin aber dort habe ich leider keinen .conf datei gefunden!
                das einzige was ich konfuguriert habe ist, die httpd.conf datei unter apache!

                Gruss


                Wer Liebe gibt, kriegt auch Liebe zurück. Daher hasse ich PHP ;-)

                Kommentar


                • #9
                  Original geschrieben von -=Taipan=-
                  ja ich habe phpmyadmin aber dort habe ich leider keinen .conf datei gefunden!
                  die heisst auch config.inc.php
                  INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


                  Kommentar


                  • #10
                    jep! ich habe es gefunden und was soll ich hier jetzt verändern?
                    ausserdem weiss ich nicht, ob ich es unter apache .conf datei oder sql my.ini datei einen pfad angeben muss, damit phpmyadmin funkt!

                    Danke das du soviel gedult mit mir hast und immer wieder antwortest


                    Wer Liebe gibt, kriegt auch Liebe zurück. Daher hasse ich PHP ;-)

                    Kommentar


                    • #11
                      Original geschrieben von -=Taipan=-
                      jep! ich habe es gefunden und was soll ich hier jetzt verändern?
                      gar nichts .....

                      wenn der phpmyadmin bei dir funzt, hast du dort zumindest den richtigen zugang zur db gespeichert. diese daten brauchst du nur noch in dein script übernehmen. das wars.
                      INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


                      Kommentar


                      • #12
                        vesteh ich nicht!
                        was meinst du mit nichts?wenn ich nichts mache, wird sich auch nichts ändern und dann werden meine haare noch mehr grau

                        so sieht es mommentan bei mir aus! muss ich da kein neuen user mit pass eintragen und vieleicht ein paar pfads unter vieleicht my.ini oder httpd.conf ändern, damit es funkt? wenn ja, wie geht das eignetlich??? ich weiss! bin echt nicht der hellste

                        <?php
                        /* $Id: config.inc.php,v 1.158 2003/02/09 16:03:05 rabus Exp $ */
                        // vim: expandtab sw=4 ts=4 sts=4:

                        /**
                        * phpMyAdmin Configuration File
                        *
                        * All directives are explained in Documentation.html
                        */


                        /**
                        * Sets the php error reporting - Please do not change this line!
                        */
                        if (!isset($old_error_reporting)) {
                        error_reporting(E_ALL);
                        @ini_set('display_errors', '1');
                        }


                        /**
                        * Your phpMyAdmin url
                        *
                        * Complete the variable below with the full url ie
                        * http://www.your_web.net/path_to_your...min_directory/
                        *
                        * It must contain characters that are valid for a URL, and the path is
                        * case sensitive on some Web servers, for example Unix-based servers.
                        *
                        * In most cases you can leave this variable empty, as the correct value
                        * will be detected automatically. However, we recommend that you do
                        * test to see that the auto-detection code works in your system. A good
                        * test is to browse a table, then edit a row and save it. There will be
                        * an error message if phpMyAdmin cannot auto-detect the correct value.
                        *
                        * If the auto-detection code does work properly, you can set to TRUE the
                        * $cfg['PmaAbsoluteUri_DisableWarning'] variable below.
                        */
                        $cfg['PmaAbsoluteUri'] = 'http://127.0.0.1/phpmyadmin/';


                        /**
                        * Disable the default warning about $cfg['PmaAbsoluteUri'] not being set
                        * You should use this if and ONLY if the PmaAbsoluteUri auto-detection
                        * works perfectly.
                        */
                        $cfg['PmaAbsoluteUri_DisableWarning'] = FALSE;

                        /**
                        * Disable the default warning that is displayed on the DB Details Structure page if
                        * any of the required Tables for the relationfeatures could not be found
                        */
                        $cfg['PmaNoRelation_DisableWarning'] = FALSE;


                        /**
                        * Server(s) configuration
                        */
                        $i = 0;
                        // The $cfg['Servers'] array starts with $cfg['Servers'][1]. Do not use $cfg['Servers'][0].
                        // You can disable a server config entry by setting host to ''.
                        $i++;
                        $cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname
                        $cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port
                        $cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket
                        $cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket')
                        $cfg['Servers'][$i]['compress'] = FALSE; // Use compressed protocol for the MySQL connection
                        // (requires PHP >= 4.3.0)
                        $cfg['Servers'][$i]['controluser'] = ''; // MySQL control user settings
                        // (this user must have read-only
                        $cfg['Servers'][$i]['controlpass'] = ''; // access to the "mysql/user"
                        // and "mysql/db" tables)
                        $cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
                        $cfg['Servers'][$i]['user'] = 'root'; // MySQL user
                        $cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed
                        // with 'config' auth_type)
                        $cfg['Servers'][$i]['only_db'] = ''; // If set to a db-name, only
                        // this db is displayed
                        // at left frame
                        // It may also be an array
                        // of db-names
                        $cfg['Servers'][$i]['verbose'] = ''; // Verbose name for this host - leave blank to show the hostname

                        $cfg['Servers'][$i]['pmadb'] = ''; // Database used for Relation, Bookmark and PDF Features
                        // - leave blank for no support
                        $cfg['Servers'][$i]['bookmarktable'] = ''; // Bookmark table - leave blank for no bookmark support
                        $cfg['Servers'][$i]['relation'] = ''; // table to describe the relation between links (see doc)
                        // - leave blank for no relation-links support
                        $cfg['Servers'][$i]['table_info'] = ''; // table to describe the display fields
                        // - leave blank for no display fields support
                        $cfg['Servers'][$i]['table_coords'] = ''; // table to describe the tables position for the PDF
                        // schema - leave blank for no PDF schema support
                        $cfg['Servers'][$i]['pdf_pages'] = ''; // table to describe pages of relationpdf
                        // - leave blank if you don't want to use this
                        $cfg['Servers'][$i]['column_comments'] // table to store columncomments
                        = ''; // - leave blank if you don't want to use this
                        $cfg['Servers'][$i]['AllowDeny']['order'] // Host authentication order, leave blank to not use
                        = '';
                        $cfg['Servers'][$i]['AllowDeny']['rules'] // Host authentication rules, leave blank for defaults
                        = array();


                        $i++;
                        $cfg['Servers'][$i]['host'] = '';
                        $cfg['Servers'][$i]['port'] = '';
                        $cfg['Servers'][$i]['socket'] = '';
                        $cfg['Servers'][$i]['connect_type'] = 'tcp';
                        $cfg['Servers'][$i]['compress'] = FALSE;
                        $cfg['Servers'][$i]['controluser'] = '';
                        $cfg['Servers'][$i]['controlpass'] = '';
                        $cfg['Servers'][$i]['auth_type'] = 'config';
                        $cfg['Servers'][$i]['user'] = 'root';
                        $cfg['Servers'][$i]['password'] = '';
                        $cfg['Servers'][$i]['only_db'] = '';
                        $cfg['Servers'][$i]['verbose'] = '';
                        $cfg['Servers'][$i]['pmadb'] = '';
                        $cfg['Servers'][$i]['bookmarktable'] = '';
                        $cfg['Servers'][$i]['relation'] = '';
                        $cfg['Servers'][$i]['table_info'] = '';
                        $cfg['Servers'][$i]['table_coords'] = '';
                        $cfg['Servers'][$i]['pdf_pages'] = '';
                        $cfg['Servers'][$i]['column_comments'] = '';
                        $cfg['Servers'][$i]['AllowDeny']['order']
                        = '';
                        $cfg['Servers'][$i]['AllowDeny']['rules']
                        = array();

                        $i++;
                        $cfg['Servers'][$i]['host'] = '';
                        $cfg['Servers'][$i]['port'] = '';
                        $cfg['Servers'][$i]['socket'] = '';
                        $cfg['Servers'][$i]['connect_type'] = 'tcp';
                        $cfg['Servers'][$i]['compress'] = FALSE;
                        $cfg['Servers'][$i]['controluser'] = '';
                        $cfg['Servers'][$i]['controlpass'] = '';
                        $cfg['Servers'][$i]['auth_type'] = 'config';
                        $cfg['Servers'][$i]['user'] = 'root';
                        $cfg['Servers'][$i]['password'] = '';
                        $cfg['Servers'][$i]['only_db'] = '';
                        $cfg['Servers'][$i]['verbose'] = '';
                        $cfg['Servers'][$i]['pmadb'] = '';
                        $cfg['Servers'][$i]['bookmarktable'] = '';
                        $cfg['Servers'][$i]['relation'] = '';
                        $cfg['Servers'][$i]['table_info'] = '';
                        $cfg['Servers'][$i]['table_coords'] = '';
                        $cfg['Servers'][$i]['pdf_pages'] = '';
                        $cfg['Servers'][$i]['column_comments'] = '';
                        $cfg['Servers'][$i]['AllowDeny']['order']
                        = '';
                        $cfg['Servers'][$i]['AllowDeny']['rules']
                        = array();

                        // If you have more than one server configured, you can set $cfg['ServerDefault']
                        // to any one of them to autoconnect to that server when phpMyAdmin is started,
                        // or set it to 0 to be given a list of servers without logging in
                        // If you have only one server configured, $cfg['ServerDefault'] *MUST* be
                        // set to that server.
                        $cfg['ServerDefault'] = 1; // Default server (0 = no default server)
                        $cfg['Server'] = '';
                        unset($cfg['Servers'][0]);
                        Zuletzt geändert von -=Taipan=-; 07.05.2003, 17:19.


                        Wer Liebe gibt, kriegt auch Liebe zurück. Daher hasse ich PHP ;-)

                        Kommentar


                        • #13
                          da stehts doch.

                          $cfg['Servers'][$i]['user'] = 'root'; // MySQL user
                          $cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed


                          user => root
                          password => >NIX<

                          also übernimmst du diese daten in dein script.

                          PHP-Code:
                          $dbx = @mysql_connect("localhost""root"""); 
                          INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


                          Kommentar


                          • #14
                            JUUHHHUUU!

                            Abraxax du bist ein schatz!!!

                            Wenn du bei mir in der nähe währest, dann hätte ich dich auf jedenfall zum Pizza oder Kebab eingeladen!

                            oder auch bierle


                            Vielen Dank mein Freund

                            Gruss


                            Wer Liebe gibt, kriegt auch Liebe zurück. Daher hasse ich PHP ;-)

                            Kommentar


                            • #15
                              Original geschrieben von -=Taipan=-
                              Abraxax du bist ein schatz!!!
                              OffTopic:
                              doch nicht in der öffentlichkeit.....
                              INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


                              Kommentar

                              Lädt...
                              X