#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    I installed php4,MySQL,Apache on my Windows98 system. Everything works up to the point of connecting to Mysql. Then I can't get it to do anything else.
    this works to connect:

    $connection = mysql_connect("localhost", "user", "xxxxxxxx")
    or die ("couldn't connect");
    if ($connection) {
    $msg = "success!";
    }
    ?>
    But when I try to anything like create a database I get the errors (in this case 'couldn't create database'.)

    <?
    $new_db = "cosmos";
    $connection = @mysql_connect("localhost", "user", "xxxxxxxxx") or die ("Couldn't connect.");
    $result = @mysql_create_db($new_db,$connection) or die ("Couldn't create database");
    if ($result) {
    $msg = "<p>Database has been created</p>";
    }
    ?>

    <html>
    <head>
    <title>Create a MySQL Database</title>
    </head>
    <body>
    <? echo "$msg"; ?>
    </body>
    </html>

    I email the author of the book and she asked if my daemon was started, but failed to tell me where or how to look to see if it is.
    Any help would be appreciated
    Thank you.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    14
    I will assume the daemon was started since your connect statement worked as you stated above. but just to make sure go to the folder where you installed mysql go into the bin dir and type mysqld this should get the dameon going. Make sure that the use you are trying to create the databse with has the right priviledges. you should try connecting as root.

    [This message has been edited by freddydoesphp (edited October 26, 2000).]
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    I have mysqld-shareware in the bin directory.
    When I create a username and password I did so from the mysql monitor and then went to mysqladim flush-privileges.
    The only other thing I can think of is what you wrote about checking if I have the right privileges. How do I check that?
    I new to this, but it was thrown in my lap and consider this a crash course. Your promptness is very much appreciated, believe me!
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    14
    Okay so run mysqld-shareware to start the dameon and then use the suername and password that used when you set up the server in your connect statement. It is probably easier to just create the db from the command line:
    In the bin dir
    type
    mysqladmin CREATE dbname

IMN logo majestic logo threadwatch logo seochat tools logo