SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lost root password - how to reset?

    Hi. I've lost my root password.

    I'm using Mac OS X 10.2.5. I had a 3.x install of MySQL, and decided to update to 4.0.12 using the Mac OS X installer package from mysql.com.

    Unfortunately, I forgot the root password I originally used, and it seems to be persistant. I've deleted the previous mysql installation files, but that didn't seem to make any difference. I've deleted the mysql user using NetInfo manager but that didn't seem to make any difference. I deleted the mysql user AND the new MySQL install and reinstalled. No difference.

    In addition now when I try to start mysql I get
    ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    I don't know enough about this to even know where to start debugging the problem.

    What I would really like is to know how to completely remove MySQL and all related files and do a clean install. I would settle for being able to reset my root password (or passwords -- the searches I've done on this forum seem to imply there may be two).

    I have no existing databases to fear losing. I just want to work through the MySQL/PHP book I bought from SitePoint, and I can't move forward without knowing/resetting the mysql root password(s).

    Thanks.

  2. #2
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  3. #3
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Son Nguyen
    Yes, I tried that page before I posted here. I'm on a Mac, FreeBSD-based Darwin. Those instructions appear not to apply.

    Here's the breakdown:

    >Question :
    >I have lost my MySQL root password, how can I get in?
    >Answer :
    >If you have forgotten the root user password for MySQL, you can
    >restore it with the following procedure:
    >
    >Take down the mysqld server by sending a kill (not kill -9) to the
    >mysqld server.

    Already not running.

    >The pid is stored in a .pid file, which is normally in the MySQL
    >database directory:
    >kill `cat /mysql-data-directory/hostname.pid`

    No such file as "hostname.pid". Stike one.

    >You must be either the Unix root user or the same user the server
    >runs as to do this.

    Used sudo, which is awkward but can be done. Bunt.

    >Restart mysqld with the --skip-grant-tables option.

    % mysql
    yields:

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

    and

    % mysql -h hostname mysql
    yields:

    ERROR 2005: Unknown MySQL Server Host 'hostname' (1)

    Strike two.

    Being unable to launch mysql pretty much negates the whole of the rest of the advice below.

    Strike three, I'm out.

    I've spent a couple of hours trying to figure out how to solve the /tmp/mysql.sock problem, but my sock puppet skills are not l33t.

    So until I figure out the sock problem, I can't figure out the root problem. I'm starting to feel like a badly-dressed gardener. Or a cross between the Beasties and the Chili Peppers.

    And that's why I wish I could go back to square one and do a clean install.

    >Connect to the mysqld server with mysql -h hostname mysql and
    >change the password with a GRANT command.
    >
    >See section 7.35 GRANT and REVOKE Syntax
    >http://www.mysql.com/doc/G/R/GRANT.html
    >
    >You can also do this with mysqladmin -h hostname -u user
    >password 'new password'
    >
    >Load the privilege tables with: mysqladmin -h hostname
    >flush-privileges or with the SQL command FLUSH PRIVILEGES.
    >
    >Note that after you started mysqld with --skip-grant-tables, any
    >usage of GRANT commands will give you an Unknown command error
    >until you have executed FLUSH PRIVILEGES.


Bookmarks

Posting Permissions

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