Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Help with SQL

Options
  • 12-06-2009 8:45pm
    #1
    Closed Accounts Posts: 218 ✭✭


    Hi, im using xampp and trying to get SQL up and running to learn PHP but having no luck. Im good at programming but when it comes to stuff like databases i be lost. ANyway i have the SQL command prompt up here and when i type CREATE DATABASE xyz; it responds back saying ERROR 1044 <42000>: Access denied for user ''@' localhost' to database 'xyz'. The solution is probably something simple but as i said i havent a clue with this. I just want to get into the actual coding :pac: Please help thanks :)


Comments

  • Closed Accounts Posts: 218 ✭✭Gu3rr1lla


    betafrog wrote: »
    have you already set up an account for MySQL? If you haven't then run MySQL using

    mysql -u root

    if you have you'll need

    mysql -u root -p

    and it'll ask for the password..

    If you're using XAMPP though you're better off using PHPMyAdmin
    go to http://localhost/phpmyadmin it's a web based gui for setting up and admining DB's...

    Cheers! Im a bit confused, so i put in:

    mysql> mysql -u root
    -> mysql -u root -p
    ->


    (i tried without the word mysql aswell incase you were using mysql as reference for mysql>)

    if so, how do i break out of this without using \c ?

    Noob questions i know but once i get into this i'll be fine (i hope lol)

    EDIT: I went into phpmyadmin and found 4 users (2 with root privileges) so im guessing my question now is how do i log in using these guys?

    EDIT2: Ok so i changed the permissions of the '' user and bingo i can create databases now, onwards we go!


  • Users Awaiting Email Confirmation Posts: 351 ✭✭ron_darrell


    I think you're misunderstanding the help here - the "mysql -u root -p" command is entered at the DOS prompt not at the mysql prompt


  • Closed Accounts Posts: 218 ✭✭Gu3rr1lla


    I think you're misunderstanding the help here - the "mysql -u root -p" command is entered at the DOS prompt not at the mysql prompt

    Yes i really am! The penny hasnt dropped yet. I learnt the coding part of MySQL in college using Oracle but dont how to do things like setting it up. I dont have a clue what im doing now and so far all the tutorials i've read dont make sense/dont work. Im just going about this step by step as much as i can.

    I tried putting that code into the command prompt and got the following error:

    'mysql' is not recognised as an internal or external command, operable program or batch file.

    I'll figure this out eventually! Any links, book recommendations, or advice welcome! cheers


  • Registered Users Posts: 1,127 ✭✭✭smcelhinney


    that error just means that the mysql binary is not in the PATH on your machine. Just hold windows key and hit Pause/Break go to Advanced tab, select Environment Variables. then find the PATH variable in the System variables section, and edit it, add a colon ; at the end, and then add the full path to MySQL binary dir to the end. I think the default one is something like C:\Program Files\MySql\bin or something. Once this is done, open command prompt as normal. Then follow instructions above.

    Also, would very much recommend either phpmyadmin as suggested, or even the native mysql query browser that ships with the mysql application. You will find it quite easy to use, you can either use the gui or just type sq, same result.

    Happy SQL'ing..


  • Closed Accounts Posts: 218 ✭✭Gu3rr1lla


    that error just means that the mysql binary is not in the PATH on your machine. Just hold windows key and hit Pause/Break go to Advanced tab, select Environment Variables. then find the PATH variable in the System variables section, and edit it, add a colon ; at the end, and then add the full path to MySQL binary dir to the end. I think the default one is something like C:\Program Files\MySql\bin or something. Once this is done, open command prompt as normal. Then follow instructions above.

    Also, would very much recommend either phpmyadmin as suggested, or even the native mysql query browser that ships with the mysql application. You will find it quite easy to use, you can either use the gui or just type sq, same result.

    Happy SQL'ing..

    Good news.. i think i've found out how to do this. Is typing the following into cmd the same as what you have said? cd C:\xampp\mysql\bin then i can set -u and -p and allows me to use sql then.

    Yeah that phpmyadmin looks good gona give that a gander now cheers :)


  • Advertisement
  • Registered Users Posts: 2,894 ✭✭✭TinCool


    thold windows key and hit Pause/Break go to Advanced tab, select Environment Variables.

    Cool. That's a handy shortcut. That's up there with Windows Key + L to lock your PC.


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    TinCool wrote: »
    Cool. That's a handy shortcut. That's up there with Windows Key + L to lock your PC.
    I found Windows + D the most useful one, especially in work :pac:


Advertisement