How to log into MySQL as root user in Plesk

Plesk-LogoYou may have noticed that there is no MySQL root user on servers running Plesk. That’s because Plesk renames this user into “admin” by default – for security reasons.

The password for the admin MySQL account is the same as for the Plesk Panel admin account.

Even so, when you try to login to MySQL – remotely or locally – you may be puzzled to find that your admin password doesn’t seem to work. Let me assure you of your sanity and your keyboard skills: it’s because Plesk encrypts the password in the database.

It is the encrypted version that you must present to MySQL, not the clear version. For example, if your password was indeed “password”, then the following command will not grant you access to MySQL:

You can check your unencrypted password by issuing the following command (on Linux servers):

In our example, it will indeed show “password” – so why doesn’t it work? It’s because that command will unencrypted the password for us. MySQL however needs the encrypted version. Here’s how we can extract this from Plesk:

This will give you a weird looking output as shown above. Believe it or not, that’s your MySQL admin password!

If you’re already logged into your server as root and want to issue a MySQL shell command, you can login to MySQL like so:

If you’re attempting a remote connection to MySQL then simply paste that cryptic looking password you got in the earlier step.

  • http://kb.parallels.com/en/427

Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.

One thought on “How to log into MySQL as root user in Plesk

  1. If your memory is a bitch, like mine use this to access directly:

    root@server:[~]: cat /etc/psa/.psa.shadow
    $AES-128-CBC$S2oUU99k2Qs988Ds0Cmq0w==$7/Ec2BecQpaL5XpimHrPs4UWxUis509CVBseFB1+w/GjXkfDOkMYw8u7/io7YurU

    root@server:[~]: cat /root/.my.cnf
    [client]
    password=$AES-128-CBC$S2oUU99k2Qs988Ds0Cmq0w==$7/Ec2BecQpaL5XpimHrPs4UWxUis509CVBseFB1+w/GjXkfDOkMYw8u7/io7YurU
    user=admin

    root@server:[~]: mysql
    mysql>

Add your voice!