#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,650
    Rep Power
    171

    Ubuntu forgot mysql root password


    Hi

    How can I reset mysql server password?
    Code:
    root@behnam:/etc# cat /etc/*-release
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=12.10
    DISTRIB_CODENAME=quantal
    DISTRIB_DESCRIPTION="Ubuntu 12.10"
    NAME="Ubuntu"
    VERSION="12.10, Quantal Quetzal"
    ID=ubuntu
    ID_LIKE=debian
    PRETTY_NAME="Ubuntu quantal (12.10)"
    VERSION_ID="12.10"
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,965
    Rep Power
    9397
  4. #3
  5. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,650
    Rep Power
    171
    Originally Posted by requinix
    Yes already tried that before I post this
    root@behnam:/# sudo /etc/init.d/mysql stop
    Rather than invoking init scripts through /etc/init.d, use the service(8)
    utility, e.g. service mysql stop

    Since the script you are attempting to invoke has been converted to an
    Upstart job, you may also use the stop(8) utility, e.g. stop mysql
    root@behnam:/# sudo mysqld --skip-grant-tables &
    [1] 973
    root@behnam:/# mysql -u root mysql
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
    root@behnam:/#
  6. #4
  7. Wiser? Not exactly.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    5,932
    Rep Power
    4033
    Make sure mysql is actually stopped before trying to re-start it. As the output suggests, use service mysql stop rather than the /etc/init.d script when stopping mysql.

    Once you verified that mysql is successfully stopped (check ps aux output for mysqld, or try connecting) then start it again using the --skip-grant-tables option.
    Recycle your old CD's, don't just trash them



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  8. #5
  9. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,650
    Rep Power
    171
    Originally Posted by kicken
    Make sure mysql is actually stopped before trying to re-start it. As the output suggests, use service mysql stop rather than the /etc/init.d script when stopping mysql.

    Once you verified that mysql is successfully stopped (check ps aux output for mysqld, or try connecting) then start it again using the --skip-grant-tables option.
    # service mysql stop
    stop: Unknown instance:

    More:

    # sudo /etc/init.d/mysql stop
    Rather than invoking init scripts through /etc/init.d, use the service(8)
    utility, e.g. service mysql stop

    Since the script you are attempting to invoke has been converted to an
    Upstart job, you may also use the stop(8) utility, e.g. stop mysql
    # service mysql stop
    stop: Unknown instance:
    # stop mysql
    stop: Unknown instance:
    # sudo mysqld --skip-grant-tables &
    [1] 26193
    # mysql -u root mysql
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
    Last edited by English Breakfast Tea; October 17th, 2013 at 10:49 PM.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    862
    Rep Power
    275
    what is this line supposed to represent?
    Code:
    # mysql -u root mysql
    if your root user has a password of mysql, you are entering it wrong

    it should be
    Code:
    # mysql -u root -pmysql
    with no space between the -p and the password
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,436
    Rep Power
    1688
    It's an attempt to start mysql command line interface using the root user and aiming to connect to the database called mysql.
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc
  14. #8
  15. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,650
    Rep Power
    171
    Not sure what happened but worked this time!
    Code:
    root@behnam:/etc/init.d# sudo /etc/init.d/mysql stop
    Rather than invoking init scripts through /etc/init.d, use the service(8)
    utility, e.g. service mysql stop
    
    Since the script you are attempting to invoke has been converted to an
    Upstart job, you may also use the stop(8) utility, e.g. stop mysql
    mysql stop/waiting
    root@behnam:/etc/init.d# service mysql stop
    stop: Unknown instance: 
    root@behnam:/etc/init.d# sudo mysqld --skip-grant-tables &
    [1] 24278
    root@behnam:/etc/init.d# mysql -u root mysql
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 5.5.32-0ubuntu0.12.10.1 (Ubuntu)
    
    Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>

IMN logo majestic logo threadwatch logo seochat tools logo