LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-20-2016, 01:44 AM   #1
dmchess
Member
 
Registered: Jan 2005
Posts: 244

Rep: Reputation: 43
Mariadb issues


I am having trouble setting up mariadb on a laptop I just purchased.
It won't let me sign in, I am not sure what the preset password is, so I did the following:

1. I stopped mysqld
2. I started it up again using "sudo mysqld_safe --skip-grant-tables &"

Then I was able to go in and change the password




terry@Mercury ~ $ mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.0.27-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04did the following

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> UPDATE user SET password="MyPassword" WHERE User='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0


I then got out of mysql client, restarted the server and sign back in and I was refused again.
I had made sure the server stopped with a ps command. It hadn't, so I killed it with a killall and made sure it was ended and then restarted it.

And I still can't get in:

terry@Mercury ~ $ mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Yes I was sure the server was running.
Thx for any assistance.
 
Old 10-20-2016, 01:53 AM   #2
dmchess
Member
 
Registered: Jan 2005
Posts: 244

Original Poster
Rep: Reputation: 43
I forgot to mention, this is a LinuxMint-64 install.

Terry
 
Old 10-20-2016, 02:29 AM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
This will not work because the password is not stored as plain text...

Code:
UPDATE user SET password="MyPassword" WHERE User='root';
Either of these should do it however:

Code:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyPassword');

OR

UPDATE user SET Password=PASSWORD('MyPassword') WHERE User='root' AND Host='localhost';
I would prefer the first as opposed to directly altering the grant tables.
 
Old 10-20-2016, 10:19 AM   #4
dmchess
Member
 
Registered: Jan 2005
Posts: 244

Original Poster
Rep: Reputation: 43
I pointed it to a different repository and reinstalled. This time it asked me to set a password on install. But when I try to connect I get the following error:

terry@Mercury ~ $ ps -ef | grep mysql
mysql 14849 1 2 10:01 ? 00:00:00 /usr/sbin/mysqld
terry 14912 5036 0 10:01 pts/2 00:00:00 grep --color=auto mysql
terry@Mercury ~ $ mysql -u root -p
Enter password:
ERROR 1524 (HY000): Plugin 'unix_socket' is not loaded

I have never had so much trouble getting mysql or mariadb installed and working. Mysql won't install and MariaDB isn't working. Terry
 
Old 10-20-2016, 10:55 AM   #5
dmchess
Member
 
Registered: Jan 2005
Posts: 244

Original Poster
Rep: Reputation: 43
I started mariadb back up in safe mode and issued the following command:

install plugin unix_socket soname 'auth_socket';

After restarting the server, I am back to getting:

mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

I went back in and tried changing the root password with your commands:

UPDATE user SET Password=PASSWORD('MyPassword') WHERE User='root' AND Host='localhost';

The 1st way does not work, it complains about being in safe mode:

ERROR 1290 (HY000): The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement

I am still getting access denied.
 
Old 10-20-2016, 01:59 PM   #6
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by dmchess View Post
I pointed it to a different repository and reinstalled. This time it asked me to set a password on install. But when I try to connect I get the following error:

...

I have never had so much trouble getting mysql or mariadb installed and working. Mysql won't install and MariaDB isn't working. Terry
Reinstalling and using alternate repositories is not an appropriate action for resetting a password. Now we don't really know the system state.

I am not a Mint/Buntu user so will not offer further advice with regards to the installation state, perhaps someone else can chime in on that subject.

But back to MySQL/MariaDB, beginning from the state where you are able to start the MySQL server normally, read the following from the MySQL manual which seems the right way to recover from forgotten (or unknown) MySQL root user password:

B.5.3.2.2 Resetting the Root Password: Unix and Unix-Like Systems

That is from the MySQL 5.7 manual but covers earlier versions. If you are running from the MariaDB 10.x series I would also expect it to work, but if not please post any errors here before doing other things which might confuse us.

And for clarity of our thought processes, this is not a MariaDB "problem", it is simply an unknown password, now confused by a somewhat vague reinstallation. Focus on simply resetting the password, not fixing something that is not broken.

Last edited by astrogeek; 10-20-2016 at 02:02 PM.
 
Old 10-20-2016, 02:29 PM   #7
petelq
Member
 
Registered: Aug 2008
Location: Yorkshire
Distribution: openSUSE(Leap and Tumbleweed) and a (not so) regularly changing third and fourth
Posts: 627

Rep: Reputation: Disabled
Try logging in as root without the password ie
Code:
mysql -u root mysql
If that works you can then set the root password.
In my (limited) experience root starts out without a password and you set it when first logging in.
I'm just not sure, if you don't have root set up, how you could set up any other users.
 
Old 10-20-2016, 04:50 PM   #9
dmchess
Member
 
Registered: Jan 2005
Posts: 244

Original Poster
Rep: Reputation: 43
I solved it. I blew LinuxMint away and put on UbuntuMate and afterwards had Mysql running within 15 minutes.
 
Old 10-20-2016, 06:03 PM   #10
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by dmchess View Post
I solved it. I blew LinuxMint away and put on UbuntuMate and afterwards had Mysql running within 15 minutes.
You ended it, you did not solve it...

But moving right along... good luck!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Cant start MariaDB AdultFoundry Linux - Newbie 1 10-10-2016 08:54 AM
MariaDB ? dmchess Linux - Software 1 04-04-2015 11:06 AM
Keep using MySQL instead of MariaDB kelaskakap Slackware 17 12-13-2013 06:43 PM
Any issues seen with MariaDB 10.0.2 here? tallship Slackware 1 05-29-2013 04:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration