How can I reset root password?

Good afternoon fellas.

I am facing a major problem lately.
Recently I've taken an already deployed project from a previous developer and want to make some changes.
Although, I do not have access to MySQL Database via root unfortunately.
I've followed the instructions of Support Centre (and google search) using sudo dpkg-reconfigure mysql-server-5.5 command in terminal (the solution guide https://www.linode.com/docs/databases/mysql/how-to-install-mysql-on-debian-8/#reset-the-mysql-root-password )

but got an error message like : mysql-server-5.5 is not installed
I've tried to check MySQL version to see if that's the case but when I type: mysql -v , it asks me for root password.

Any bright ideas on how to face that?
Thank you in advance,
Yours Sincerely.

7 Replies

Linode Staff

Hey there!

It looks like the main issue may be you are using a different a different MySQL version. For example, you could be using mysql-server-5.6 or later. One way to check would be to run the following command mysql -v.

From there you would want to run sudo dpkg-reconfigure mysql-server-x.x where x.x is the version number displayed. If you want to provide the output of that command we can certainly take a look and see if there's anything else we can do to get that root password reset for you.

Hello,

First things first, thank you for the reply.
As I've already mentioned above, I tried to use mysql-v, although it gives me the exact error:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO).

I am giving you the full log of: <span style="background-color:#1a1a1a; color:white;">sudo dpkg-reconfigure mysql-server-5.5 </span>



root@Travelusive:/home/forge/mytravelusive.com/public/wp-content/themes/understrap-0.3.7/assets/favicon# dpkg-reconfigure mysql-server-5.5

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:
LANGUAGE = (unset),

LC_ALL = (unset),

LC_PAPER = "el_GR.UTF-8",

LC_ADDRESS = "el_GR.UTF-8",

LC_MONETARY = "el_GR.UTF-8",

LC_NUMERIC = "el_GR.UTF-8",

LC_TELEPHONE = "el_GR.UTF-8",

LC_IDENTIFICATION = "el_GR.UTF-8",

LC_MEASUREMENT = "el_GR.UTF-8",

LC_TIME = "el_GR.UTF-8",

LC_NAME = "el_GR.UTF-8",

LANG = "en_US.UTF-8"

are supported and installed on your system.

perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
dpkg-query:
package 'mysql-server-5.5' is not installed and no information is available

Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
/usr/sbin/dpkg-reconfigure: mysql-server-5.5 is not installed

Moreover, the result of : mysql -v :
root@Travelusive:/home/forge/mytravelusive.com/public/wp-content/themes/understrap-0.3.7/assets/favicon# mysql -v
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

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

You need to use sudo mysql -v

Nop, it does the same thing.

The command to find mysql version would be sudo mysql --version if not root user.

-v is used for verbose mode. Use -V(cap v) like sudo mysql -V.

Check mysql help or it's man page. mysql --help.

Hope it help.

@agbirbakos

Didn't get you @tusisobar buddy. Can you explain it please

@jermaine_dean sure. The OP want to reset root password. For that he tried to know which MySQL version he has installed.

By default mysql -v does not show version, it show logs etc in verbose mode(provides more info). So this command will ask for root password, instead showing you version.

To get the version, correct command is mysql -V or mysql --version.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct