LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Mariadb issues (https://www.linuxquestions.org/questions/linux-server-73/mariadb-issues-4175591803/)

dmchess 10-20-2016 01:44 AM

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.

dmchess 10-20-2016 01:53 AM

I forgot to mention, this is a LinuxMint-64 install.

Terry

astrogeek 10-20-2016 02:29 AM

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.

dmchess 10-20-2016 10:19 AM

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

dmchess 10-20-2016 10:55 AM

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.

astrogeek 10-20-2016 01:59 PM

Quote:

Originally Posted by dmchess (Post 5620577)
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.

petelq 10-20-2016 02:29 PM

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.

szboardstretcher 10-20-2016 02:43 PM

https://www.godaddy.com/help/reset-y...rd-linux-17548
https://support.rackspace.com/how-to...root-password/
http://fibrevillage.com/database/512...-root-password
https://www.liberiangeek.net/2014/10...iadb-centos-7/

Take your pick.

dmchess 10-20-2016 04:50 PM

I solved it. I blew LinuxMint away and put on UbuntuMate and afterwards had Mysql running within 15 minutes.

astrogeek 10-20-2016 06:03 PM

Quote:

Originally Posted by dmchess (Post 5620748)
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... :rolleyes:

But moving right along... good luck!


All times are GMT -5. The time now is 03:57 AM.