magals
Posts: 2
Joined: Fri Mar 14, 2014 12:00 pm

MySql password?

Fri Mar 14, 2014 12:12 pm

Hi, I installed mysql-server (apt-get install). I did not get prompted for a password. It just says that it is setting upp mysql... and soon therafter it looks as if it is done - no protests.

Now I have no idea what password has been set to mysql. I tried to setup mediawiki and chose mysql as db but an empty password was not accepted so I guess there is some password. On the command line I type mysql -p -u root, and if I type no password I do not get in : "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)" If I guess a password, the result is almost the same, except the last word is YES instad of NO.

Googling just tells me I will get prompted for password duŕung mysql installation. I do not get propted. I tried apt-get purge mysql-server, restart, reinstallation... No prompt.

What to do?

User avatar
joan
Posts: 15618
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: MySql password?

Fri Mar 14, 2014 1:46 pm

I suppose you could purge the package and re-install.

Have a look in /etc/mysql. Perhaps it's in one of the files there.

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: MySql password?

Fri Mar 14, 2014 2:08 pm

It has already happened to me too ;)

You can follow this tutorial, the section where it talks about "Unix Systems".

I can assure you it works.

magals
Posts: 2
Joined: Fri Mar 14, 2014 12:00 pm

Re: MySql password?

Fri Mar 14, 2014 4:22 pm

Thank you! The link showing how to reset the password had a working solution. A little tricky (who am I now? and why did not the & background? etc). I became root (sudo su -) and used "--user=mysql" in the starting command. Now mediawiki is running!

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: MySql password?

Fri Mar 14, 2014 4:25 pm

Great, problem solved ;)

Enzo Cardinal
Posts: 1
Joined: Tue Sep 01, 2015 6:20 am

Re: MySql password?

Tue Sep 01, 2015 6:31 am

Hello,

well as I'm new to Linux and Raspberry and mess up during the password (long story), I found the Unix System tutorial a little hard to understand luckily I found how to how to remove complete MySql on the following video:
https://www.youtube.com/watch?v=acpGzvS3r7E

which is was very helpful to me!
I hope it will be to someone else as it was for me!

Cheers
Enzo Cardinal

Bakersmansauce
Posts: 1
Joined: Wed Sep 13, 2017 3:33 am

Re: MySql password?

Wed Sep 13, 2017 3:37 am

I used this, it was super fast and easy! Hope this helps, it did for me!
https://youtu.be/khrqbfGYdH0

reduhl
Posts: 6
Joined: Thu Oct 26, 2017 4:06 pm

Re: MySql password?

Thu Dec 07, 2017 4:21 pm

I finally found a solution. The answer is NO password is set. The best way to access mysql is to sudo su which makes you root.
Then you can run the command mysql -u root -p and it will log you in. At this point your are command line connected to mysql.

I installed phpmyadmin also and it had no password. I ran the commands to alter the table and update the user table with a new password. from that point I could use phpmyadmin.

jigneshk5
Posts: 2
Joined: Sat Aug 25, 2018 5:34 pm

Re: MySql password?

Wed Aug 29, 2018 7:49 pm

sudo mysql_secure_installation
Use the above command and change the root password and other settings of MySQL easily. ;)
Btw type "none" in the starting prompt for root password

fbe
Posts: 670
Joined: Thu Aug 17, 2017 9:08 pm

Re: MySql password?

Wed Aug 29, 2018 8:34 pm

mysql_secure_installation does nothing useful on Raspbian Stretch :roll:

maisen
Posts: 2
Joined: Fri Jul 05, 2019 7:36 pm

Re: MySql password?

Fri Jul 05, 2019 7:40 pm

I had this problem too, but the solution was really easy (in my case):
  • sudo su
  • mysql -u root
  • CREATE USER username'@'localhost' IDENTIFIED BY 'password'
  • GRANT ALL PRIVILEGES ON * . * TO 'username'@'localhost'
That's all and worked for me.

best regards
maisen

Return to “Beginners”