louellgat
Posts: 1
Joined: Sun Sep 17, 2017 1:17 pm

Installing mysql-server problem - Raspbian Stretch

Sun Sep 17, 2017 2:04 pm

Hello,

I'm trying to install mysql-server on my raspberry. I followed every tutorial in the internet and I always see a prompt that ask for root password. But when i try to install it, the installation doesn't ask for any password.

I also tried many ways to reset mysql password but it leads me to MariaDB > instead of mysql >

I hope someone can help me how to install this properly or reset the password of mysql. Thanks

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

Re: Installing mysql-server problem - Raspbian Stretch

Sun Sep 17, 2017 5:11 pm

[email protected] is authenticated via the "unix_socket" authentication plugin. You can login with

Code: Select all

sudo mysql -u root
without a password.

bobcox4usa
Posts: 2
Joined: Sun Sep 17, 2017 6:09 pm

Re: Installing mysql-server problem - Raspbian Stretch

Sun Sep 17, 2017 6:25 pm

I have same issue. And.. "mysql -u root" doesn't work for me. I also tried the mysql_secure_installation script. Anybody got more ideas?

User avatar
DougieLawson
Posts: 35814
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Installing mysql-server problem - Raspbian Stretch

Sun Sep 17, 2017 6:41 pm

That's not true unless you enable the unix_socket authorisation plugin with some special grants.

https://mariadb.com/kb/en/library/authe ... ix-socket/
which with my security hat on looks like a massive exposure.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

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

Re: Installing mysql-server problem - Raspbian Stretch

Sun Sep 17, 2017 8:02 pm

It's true for new installations on stretch. Therefore the installation doesn't ask for a root password.

User avatar
DougieLawson
Posts: 35814
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Installing mysql-server problem - Raspbian Stretch

Sun Sep 17, 2017 10:01 pm

fbe wrote:
Sun Sep 17, 2017 8:02 pm
It's true for new installations on stretch. Therefore the installation doesn't ask for a root password.
What an amazingly bad configuration decision by the Debian folks or the RPF folks. It was bad enough in the past where dpkg requested a root password and then generated a file with a "maintenance" password.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

bobcox4usa
Posts: 2
Joined: Sun Sep 17, 2017 6:09 pm

Re: Installing mysql-server problem - Raspbian Stretch

Mon Sep 18, 2017 2:18 am

I don't really care if the installation asks for a root password or not, as long as mysql -u root (-r) works and the mysql_secure_installation script works such that I can add a password after installation. Right now it's a brick.

heeed
Posts: 9
Joined: Tue Nov 27, 2012 8:17 pm
Location: Yorkshire
Contact: Website

Re: Installing mysql-server problem - Raspbian Stretch

Mon Oct 02, 2017 1:25 pm

Had this issue pop up when helping a friend out.

As dougie pointed out, mariadb by default authenticates against the current user. This can be seen by only being able to log in the database console from the root user account. This is regardless of what password you may set via mysql_secure_install.

This behaviour can be reverted to how it was before by:
sudo mysql -u root

MariaDB [none] use mysql;
MariaDB [mysql] update user set plugin='' where User='root';
MariaDB [mysql] flush privileges;
MariaDB [mysql]\q
This was adapted from: https://stackoverflow.com/questions/308 ... ord-prompt

cheddy
Posts: 24
Joined: Wed Jan 18, 2017 12:46 pm

Re: Installing mysql-server problem - Raspbian Stretch

Thu Nov 22, 2018 7:08 pm

The previous post omitted the most important bit. After doing as suggested then enter:

# mysql_secure_installation

That installation script will allow you to change the root password, among other things.

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

Re: Installing mysql-server problem - Raspbian Stretch

Thu Nov 22, 2018 9:04 pm

Use the SET PASSWORD statement in mysql (https://mariadb.com/kb/en/library/set-password/) to change the root password instead.

Reading mysql_secure_installation is more useful than executing it. You get some exercises in SQL and you might figure out, that all other things are not needed after MariaDB installation from Raspbian packages.

Return to “Troubleshooting”