Top VPS Hosting Provider

Welcome to the myhosting.com Forums.
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    juc1 is offline Silver Member
    Join Date
    Dec 2010
    Posts
    47

    Default MySQL root user password

    Hi all

    I think that the installation of MySQL on a server usually includes setting the the MySQL root user password. My new Debian 6 VPS comes with MySQL pre-installed so does that mean that the MySQL root user password has already been set? If so where do I find it? I know there are SSH commands for setting and re-setting the MySQL root user password but of course these instructions are different according to whether I am creating a password for the first time or resetting an existing password.

    Thanks


    pw.jpg

  2. #2
    jeremya is offline Administrator
    Join Date
    Jun 2008
    Posts
    270

    Default

    Hi Juc,

    This depends on whether or not you've got a control panel such as Plesk or cPanel, I believe both will set the MySQL root password accordingly (Plesk for sure). But on a vanilla VPS the password is not set at all by default.
    -Jeremya

  3. #3
    juc1 is offline Silver Member
    Join Date
    Dec 2010
    Posts
    47

    Default

    Quote Originally Posted by jeremya View Post
    Hi Juc,

    This depends on whether or not you've got a control panel such as Plesk or cPanel, I believe both will set the MySQL root password accordingly (Plesk for sure). But on a vanilla VPS the password is not set at all by default.
    Yes it is Parallels Plesk Panel 10.4.4 - but if the MySQL root password has already been set, where can I find it?

    Thanks

  4. #4
    jeremya is offline Administrator
    Join Date
    Jun 2008
    Posts
    270

    Default

    Plesk apparently renames the root user for mysql to admin and sets the password but you can use Plesk commands to retrieve it

    # /usr/local/psa/bin/admin --show-password

    KB Parallels
    -Jeremya

  5. #5
    juc1 is offline Silver Member
    Join Date
    Dec 2010
    Posts
    47

    Default

    Quote Originally Posted by jeremya View Post
    Plesk apparently renames the root user for mysql to admin and sets the password but you can use Plesk commands to retrieve it

    # /usr/local/psa/bin/admin --show-password

    KB Parallels
    yes that works to get the password, thanks, but then if I use
    Code:
    mysql -uUSERNAME -pPASSWORD
    =
    Code:
    mysql -uadmin -pmypastedpassword
    I get

    Code:
    ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
    Does that make sense?

    Thanks

    mysql denied.jpg

  6. #6
    suwunk is offline Super Moderator
    Join Date
    Aug 2010
    Posts
    1,082

    Default

    In Plesk by default mysql root is changed to admin. It's supposed to sync passwords with your admin password, but life is never that simple. Try:
    Code:
    mysql -uadmin -p `cat /etc/psa/.psa.shadow`
    linux - Using Plesk to setup MySQL - Super User

  7. #7
    juc1 is offline Silver Member
    Join Date
    Dec 2010
    Posts
    47

    Default

    Quote Originally Posted by suwunk View Post
    In Plesk by default mysql root is changed to admin. It's supposed to sync passwords with your admin password, but life is never that simple. Try:
    Code:
    mysql -uadmin -p `cat /etc/psa/.psa.shadow`
    linux - Using Plesk to setup MySQL - Super User
    I have tried two passwords - the one output by this...
    Code:
    # /usr/local/psa/bin/admin --show-password
    ...and the one that is my plesk login password but neither works and both give

    Code:
    ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
    Any suggestions please?

    Thanks
    mysql.jpg

  8. #8
    suwunk is offline Super Moderator
    Join Date
    Aug 2010
    Posts
    1,082

    Default

    Please consult customer support before applying this following solution, it may cause Plesk failed to load.

    If this following command failed
    Code:
    mysql -uadmin -p `cat /etc/psa/.psa.shadow`
    You should try this following solution:
    1.Load MySQL with the 'skip-grant-tables' option by adding skip-grant-tables into [mysqld] section of the /etc/my.cnf file
    2.Restart MySQL with the command line below:
    Code:
    # /etc/init.d/mysqld restart
    3.Repair password with the command line below:
    Code:
    # /usr/bin/mysql -D mysql -e"update user set password=PASSWORD('`cat /etc/psa/.psa.shadow`') where User='admin';"
    4.Remove skip-grant-tables option from /etc/my.cnf
    5.Restart MySQL.

    If the solution above still not working, I recommend that you contact Customer Support.
    Last edited by suwunk; 2012-07-30 at 01:43 PM.

  9. #9
    jeremya is offline Administrator
    Join Date
    Jun 2008
    Posts
    270

    Default

    Hi Juc,

    Sometimes if there are special characters in passwords, pasting into the command line login command isn't the best approach. I've found more luck by typing "mysql -u username -p". When you do this, it will prompt you for the password. You can then past or type it in manually there and you shouldn't have character problems.
    -Jeremya

  10. #10
    jeremya is offline Administrator
    Join Date
    Jun 2008
    Posts
    270

    Default

    Also, unless you want to toy with fire and break Plesk' connection to the database, i would be very careful with the previous recommendations by Suwunk.
    -Jeremya


 

Similar Threads

  1. Linux root access
    By Randy5 in forum Virtual Server
    Replies: 2
    Last Post: 2011-10-24, 11:46 AM
  2. root access
    By Stoddard in forum Virtual Server
    Replies: 1
    Last Post: 2010-11-30, 11:57 PM
  3. MySQL Problem
    By in forum How-To
    Replies: 7
    Last Post: 2010-08-23, 11:47 AM
  4. Creating Directory Above Root
    By TheWebScaper in forum How-To
    Replies: 6
    Last Post: 2009-11-06, 09:51 AM
  5. Upload website to a subfolder of Root
    By momsoft in forum Beginners
    Replies: 2
    Last Post: 2009-06-17, 03:58 AM

Posting Permissions

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