MySQL Woes - can't log into phpMyAdmin

Discussion in 'Web Design and Development' started by TheReef, Apr 9, 2008.

  1. TheReef macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #1
    Help :(

    After eventually installing and getting MySQL running (green light in System Preferences), I can't access my database. (I installed using terminal, but am very unfamiliar with it)
    I can't use the official MySQL Administrator, nor phpMyAdmin.

    When I log into phpMyAdmin with root, root I get:
    #1045 - Access denied for user 'root'@'localhost' (using password: YES)

    I tried to reset my password but get access denied errors……I have no idea.
    I am using Leopard.

    I've searched a lot, but it's down to my lack of Terminal knowledge, I think it's because I can't log into Mac OS X as root, but again I have no idea.


    Please I need some help :(
     
  2. stomer macrumors 6502a

    Joined:
    Apr 2, 2007
    Location:
    Leeds, UK
    #2
    Are phpmyadmin and mysql both running on the same machine?

    To make sure that mysql is indeed working as it should, you should try this on the machine running mysql:

    Open up terminal.app:

    Code:
    /usr/local/mysql/bin/mysql -u root -p
    
    It should ask you for a password, enter what you think your password is, and see if that allows you to login.

    P.S. Almost every day is full of mysql woe for me. Get used to it :)
     
  3. TheReef thread starter macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #3
    Thanks for your reply :)! Yep, everything is running on my machine.

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    Looks like I've forgotten it…how would I reset my password…could I find it in any of my config files?
    (again I've tried but Terminal isn't friendly with my inputs)
     
  4. stomer macrumors 6502a

    Joined:
    Apr 2, 2007
    Location:
    Leeds, UK
    #4
    It's not clear whether phpmyadmin needs extra configuration or whether there's a problem with your mysql install. Let's try to establish that mysql is working fine first, then move on to phpmyadmin. The mysql passwords are stored in the mysql db in a table called user, so no, not in a config file.

    Ok, so that means that either mysql server isn't running or the mysql.sock file is located elsewhere. It doesn't matter though, try this instead:

    Code:
    /usr/local/mysql/bin/mysql -u root -h localhost --protocol=tcp -p
    
     
  5. TheReef thread starter macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #5
    Eh sorry, disreguard that last error, I had MySQL turned off as some websites had instructed to do…

    With MySQL turned ON I get

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    When entering

    Code:
    /usr/local/mysql/bin/mysql -u root -h localhost --protocol=tcp -p
    or

    Code:
    /usr/local/mysql/bin/mysql -u root -p
     
  6. stomer macrumors 6502a

    Joined:
    Apr 2, 2007
    Location:
    Leeds, UK
    #6
    Sounds like you've forgotten your password. How did you setup mysql?

    Shutdown mysql using the System Preferences interface.

    Then run this:

    Code:
    /usr/local/mysql/bin/mysqld_safe --skip-grant-tables --autoclose
    
    That will start mysql with any security. phpmyadmin should then work, and you might be able to change the root password from there. If not, you can do it via the terminal:

    Code:
    /usr/local/mysql/bin/mysql -u root
    
    then :
    Code:
    SET PASSWORD FOR root@localhost=PASSWORD('mynewpassword');
    
     
  7. TheReef thread starter macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #7
    I get:

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
     
  8. stomer macrumors 6502a

    Joined:
    Apr 2, 2007
    Location:
    Leeds, UK
  9. TheReef thread starter macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #9
    I haven't even been able to log into it yet, I haven't created anything.
    EDIT: I just noticed you edited your above post.
    EDIT2: When running

    I get a whole lots of stuff saying permission denied.


    EDIT3:
    When running
    I get
    Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    EDIT 4: I set up MySQL through following an online walkthrough, using Terminal. I don't know what I've done…should I reinstall maybe? I tried MAMP and that doesn't work either. I have Apache with PHP working fine though.
     
  10. stomer macrumors 6502a

    Joined:
    Apr 2, 2007
    Location:
    Leeds, UK
    #10
    Stop your mysql server. Then type this to create a fresh db:
    Code:
    sudo /usr/local/mysql/scripts/mysql_install_db --user=mysql
    
    Start your sever.

    Then try:
    Code:
    /usr/local/mysql/bin/mysql -u root
    
     
  11. TheReef thread starter macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #11
    Code:
    Could not find ./bin/my_print_defaults
    
    If you are using a binary release, you must run this script from
    within the directory the archive extracted into.  If you compiled
    MySQL yourself you must run 'make install' first.
    
    :eek:
     
  12. stomer macrumors 6502a

    Joined:
    Apr 2, 2007
    Location:
    Leeds, UK
    #12
    Where did you get your mysql install from?

    Try this instead:
    Code:
    cd /usr/local/mysql/
    sudo /usr/local/mysql/scripts/mysql_install_db --user=_mysql
    
     
  13. TheReef thread starter macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #13
    I am pretty sure mysql.com.
    I remember I first downloaded the intel version by mistake (because it said 10.5) so then I downloaded the PPC version (10.4). I installed the PPC version.

    I should probably just start again, but don't known how to remove whatever I have done.

    EDIT 2:

    OK stuff came up…"Filling help tables..."

    EDIT 3: But again, starting the server and typing
    Gives me access denied.
     
  14. stomer macrumors 6502a

    Joined:
    Apr 2, 2007
    Location:
    Leeds, UK
    #14
    When you run 'mysql_install_db' it will create all the necessary databases and it should create a 'root' user without a password set. So in theory,

    Code:
    /usr/local/mysql/bin/mysql -u root
    
    should just work.
     
  15. TheReef thread starter macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #15
    /usr/local/mysql/bin/mysql -u root
    Access denied :(

    What do you mean by that?

    Btw, really sorry for keeping you so late, you should probably get some sleep ;)
     
  16. stomer macrumors 6502a

    Joined:
    Apr 2, 2007
    Location:
    Leeds, UK
    #16
    Try:

    Code:
    cd /usr/local/mysql/
    sudo rm -rf data
    sudo /usr/local/mysql/scripts/mysql_install_db --user=_mysql
    /usr/local/mysql/bin/mysql -u root
    
     
  17. TheReef thread starter macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #17
    Bahh, I get access denied for the last line……
    I will attempt to reinstall everything, sorry to keep you so late, thanks heaps for your assistance :)

    p.s can you link me to the appropriate download for a powermac g5…I seam to be really stuffing up.
     
  18. stomer macrumors 6502a

    Joined:
    Apr 2, 2007
    Location:
    Leeds, UK
    #18
    No worries. It's only midday here :)

    Yeah, if that last bunch of commands failed then it does sound as if there is something wrong with your installation. A re-install sounds like a good idea.
     
  19. TheReef thread starter macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #19
    Ok, cheers :)
    Hmmm, my dashclock says it's nighttime over there hehe :rolleyes:
    I'll report back after I reinstall, but probably tomorrow.

    EDIT:
    Never mind…:rolleyes:

    EDIT 2:[Below] thankyou bye :)[/Below]
     
  20. stomer macrumors 6502a

    Joined:
    Apr 2, 2007
    Location:
    Leeds, UK
    #20
  21. TheReef thread starter macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #21
    Yes!
    The installer you linked me too works great, I have reinstalled, changed my password and everything is working smoothly! thankyou very much for your help! :):D
     

Share This Page