Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2007
    Posts
    3

    Unanswered: How to work with winmysql admin

    http://img259.imageshack.us/img259/6200/mysqlhd8.jpg

    How to make new database, and what should i enter in this

    PHP Code:
    mysql_connect("localhost","username","pass") or die(mysql_error());  
    mysql_select_db("database") or die(mysql_error()); 
    Last edited by dimitar; 11-22-07 at 18:19.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    personally Id rather use MySQLAdmin from the MySQL GUI Tools suite available from the MySQL website.

    then you need to create your db
    create the user account(s) and assign appropriate permissions
    then you need to create the tables

    then once you have done all that you can start looking at PHP
    if you are unsure of what to put in the PHP connect and select statements then the php website is pretty helpful

    just out of curiosity what, if anything, do you think you should put in place of
    "localhost"?
    "username"?
    "pass"?
    "database"?

  4. #4
    Join Date
    Nov 2007
    Posts
    3
    Reading the tutorial i think that instead of username, i should use root, instead of pass nothing(empty)-that makes the problem, and database, i don't know.

    I'll try MySQLAdmin, but how can i add it to xampp?

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    why would you want to add MySQLAdmin to xampp?
    its a stand alone application that talks to any MySQL server that you are allowed to connect to.
    incidentally its not a good idea to have a MySQL server with a userid of root and a null/empty password.. not clever.. it leaves your server wide open to attack

    if you want to leave the user root but assign it no permissions, or better still change the password, or possibly delete root. if you do delete user root make sure you have already created a new adminstrator puserid.. and proved it has full rights to do anything to your MySQL server.

    Id suggest you create a web user account for the server which access only to the db it requires and permsiions suitable to that user (ie cannot create or delete tables, can only view the tabels it should
    And if required create other accounts with access

    as regards your guesses.. yup thats rght
    so "database" should be replaced with the naem of the databse the php script is meant to connect to

    its often a smart idea to have some form of initialisation code which sets these as variables. often this intialisation code is pulled in using an include statement as jsut about the first line of each script requiring db access. So instead of...

    mysql_connect("localhost","username","pass") or die(mysql_error());
    mysql_select_db("database") or die(mysql_error());

    you use something like....

    mysql_connect($Host,$Username,$Password) or die(mysql_error());
    mysql_select_db($Database) or die(mysql_error());

    of if you prefer use a define (by PHP convention user DEFINES are all CAPTIALS, note there is no $ prefixing the define as it is a constant not a variable
    DEFINE (HOST,"myhostname");
    DEFINE (USERNAME,"myusername");
    DEFINE(PASSWORD,"mypassword");
    DEFINE(DATABASE,"mydbname");

    .. then in your app scripts
    mysql_connect(HOST,USERNAME,PASSWORD) or die(mysql_error());
    mysql_select_db(DATABASE) or die(mysql_error());

  6. #6
    Join Date
    Nov 2007
    Posts
    3
    You don't understand me. I know to work with php and mysqlu but i don't know to work with the mysql server. I'll download now and try it.

    I downloaded MySQL GUI, but i dont know to work with it. Some guide?
    Last edited by dimitar; 11-23-07 at 13:47.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •