Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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
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:
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.
Distribution: openSUSE(Leap and Tumbleweed) and a (not so) regularly changing third and fourth
Posts: 627
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.