LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-01-2016, 02:38 AM   #16
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,357
Blog Entries: 11

Rep: Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320

@Garrett85

I had hoped that you might reply before my day ended so that your issue did not remian unresolved yet another day... but alas.

So before I disappear I thought that I would try to anticipate your answers to my questions above and provide some paths forward for you.

So, for the first case, if it turns out that your server does seem to be running, that is, if...

Code:
ps aux |grep mysqld
...OR...
service mysqld start
service mysqld stop
...show there is a mysqld process and you can start and stop it - this means the new Mint install did create a basic configuration sufficient for the server to start.

IF that is the case, then with it running (i.e. after mysqld start) simply try (as root or sudo):

Code:
mysql_secure_installation
If that runs, and you have never set a root password for it, then you will be able to simply press ENTER to bypass the root password and have the chance to set one. You will also be asked for a few other options - read them carefully, but the defaults are safe if you don't understand them.

If that works, restart the server and you are good to go!

If it doesn't, please post the result, including any messages back here.

On the other hand, if the above tests show the server is not running, we need to find and delete any stale pid file.

According to previous posts, that will be in /var/run/mysql/mysql.pid. We will run killall mysqld just to be absolutely sure...

Code:
killall mysqld
rm /var/run/mysql/mysql.pid

...then try...

mysqld_safe --user=mysql --skip-grant-tables &
If that fails, please post back any messages.

If that succeeds, run mysql_secure_installation as mentioned above and follow the prompts...

Good luck!
 
1 members found this post helpful.
Old 12-01-2016, 08:11 PM   #17
Garrett85
Member
 
Registered: Jan 2011
Posts: 280

Original Poster
Rep: Reputation: 5
Code:
user@mothership ~ $ sudo ps aux |grep mysqld
[sudo] password for user: 
root      1573  0.0  0.0  21164  3532 ?        S    19:03   0:00 /bin/bash /usr/bin/mysqld_safe
mysql     1731  0.0  1.2 608520 104400 ?       Sl   19:03   0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-log-error --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
root      1732  0.0  0.0  26092  1380 ?        S    19:03   0:00 logger -t mysqld -p daemon error
user   5522  0.0  0.0  14224   980 pts/0    S+   19:09   0:00 grep --color=auto mysql

user@mothership ~ $ service mysql stop
user@mothership ~ $ service mysql start
user@mothership ~ $
 
Old 12-01-2016, 10:51 PM   #18
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,357
Blog Entries: 11

Rep: Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320
OK, now we know the server is, in fact running at last! And it starts and stops on demand.

So, let's see if we can do this as intended by Mysql/MariaDB.

What we want to do is stop the running server, start mysqld_safe with the right parameters, then run mysql_secure_installation to complete your setup and set the root password. Like this, as root or with sudo...

Code:
service mysql stop

mysqld_safe --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --skip-grant-tables &

 -- IF that does not report ended or other error --

mysql_secure_installation
The mysql_secure_installation script will ask a few questions. Please read each one carefully and answer if you know what to do, accept the defualts otherwise.

It will first ask for your root password, you should be able to hit ENTER to bypass that, then enter your "new" root password.

IF you get through that without error, restart the server (service mysql restart) and you should be good to go.

On the other hand, IF you get stuck somewhere, tell us where and what the messages are and we will go from there...

Good luck!
 
1 members found this post helpful.
Old 12-03-2016, 10:19 AM   #19
Garrett85
Member
 
Registered: Jan 2011
Posts: 280

Original Poster
Rep: Reputation: 5
It did in fact report ended after I started mysql_safe with the paramaters you listed.

user@mothership ~ $ service mysql stop
user@mothership ~ $ mysqld_safe --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --skip-grant-tables &
[1] 6555
user@mothership ~ $ 161203 09:14:34 mysqld_safe Logging to syslog.
161203 09:14:34 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
161203 09:14:34 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Any ideas? And thanks for all your help astrogeek.
 
Old 12-05-2016, 01:32 AM   #20
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,357
Blog Entries: 11

Rep: Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320
Quote:
Originally Posted by Garrett85 View Post
It did in fact report ended after I started mysql_safe with the paramaters you listed.

user@mothership ~ $ service mysql stop
user@mothership ~ $ mysqld_safe --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --skip-grant-tables &
[1] 6555
user@mothership ~ $ 161203 09:14:34 mysqld_safe Logging to syslog.
161203 09:14:34 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
161203 09:14:34 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Any ideas? And thanks for all your help astrogeek.
You are welcome!

You will have to run mysqld_safe ... as root (or with sudo) as noted previously.

Note: I would have expected that for service mysql start/stop as well... does Mint allow non-priv users to start and stop services? This makes me wonder if your filesystem permissions are not right...?

But one thing at a time... run the same mysqld_safe line as root and see what happens.

Code:
sudo service mysql stop
sudo mysqld_safe --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --skip-grant-tables &
 
1 members found this post helpful.
Old 12-05-2016, 10:51 PM   #21
Garrett85
Member
 
Registered: Jan 2011
Posts: 280

Original Poster
Rep: Reputation: 5
I irreparably messed up my MariaDB/MySQL program when I got impatient trying to fix the issue. I just did a fresh install of my OS as well as MariaDB. Upon installing MariaDB it didn't ask me to create a root password, but now that I try to launch MariaDB it's now asking for a password. I'm assuming I just need to shut it down and do the mysql safe login thing to reset the password but I want to be sure before I screw something up again. Also, if your patients with me is at an end I completely understand.

user@mothership ~ $ mysql
ERROR 1698 (28000): Access denied for user 'user'@'localhost'
user@mothership ~ $ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
 
Old 12-06-2016, 12:15 AM   #22
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,357
Blog Entries: 11

Rep: Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320
That happens. I suspect there may have been permission problems that we never identified from the original install as noted in a previous post. So let's start fresh and not make any changes without a good reason.

As I had posted earlier (with more options) but was never tried as far as I can tell, all as root or sudo...

Code:
service mysql stop

mysqld_safe --user=mysql --skip-grant-tables &

mysql_secure_installation
If anything fails, please post the exact commands and messages here.

When you run mysql_secure_installation it will ask for the root password, but you should be able to simply hit ENTER to bypass it, then you will have a chance to set a new one. Beyond that point it is safe to accept the defaults if you do not know what to do.

If you get this far, then stop and restart mysql normally.

It is not really a matter of patience, but it shouldn't be this hard if we can just work through methodically.
 
1 members found this post helpful.
Old 12-06-2016, 07:50 PM   #23
Garrett85
Member
 
Registered: Jan 2011
Posts: 280

Original Poster
Rep: Reputation: 5
user@mothership ~ $ 161206 18:39:14 mysqld_safe Logging to syslog.
161206 18:39:14 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
161206 18:39:14 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
Enter current password for root (enter for none):

Again, this is from a clean install of Mint 18 as well as a clean install of MariaDB.
 
Old 12-06-2016, 08:42 PM   #24
Garrett85
Member
 
Registered: Jan 2011
Posts: 280

Original Poster
Rep: Reputation: 5
I finally got the password changed and it stopped giving me all those errors not now mariadb will not let me login with `mysql -u root -p` I get access denied everytime even though I'm 100% sure I'm putting in the exact same thing because I can still still what I entered on the terminal screen. What do you make of this.

user@mothership ~ $ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
user@mothership ~ $ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
user@mothership ~ $ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
user@mothership ~ $ sudo mysqld_safe --skip-grant-tables &
[2] 12970
user@mothership ~ $ 161206 19:37:50 mysqld_safe Logging to syslog.
161206 19:37:50 mysqld_safe A mysqld process already exists
mysql
ERROR 1698 (28000): Access denied for user 'user'@'localhost'
[2]+ Exit 1 sudo mysqld_safe --skip-grant-tables
user@mothership ~ $ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
user@mothership ~ $ sudo mysqld_safe --skip-grant-tables &
[2] 13151
user@mothership ~ $ 161206 19:38:35 mysqld_safe Logging to syslog.
161206 19:38:35 mysqld_safe A mysqld process already exists
mysql
ERROR 1698 (28000): Access denied for user 'user'@'localhost'
[2]+ Exit 1 sudo mysqld_safe --skip-grant-tables
 
Old 12-06-2016, 08:48 PM   #25
Garrett85
Member
 
Registered: Jan 2011
Posts: 280

Original Poster
Rep: Reputation: 5
I finally got the password changed and it stopped giving me all those errors not now mariadb will not let me login with `mysql -u root -p` I get access denied everytime even though I'm 100% sure I'm putting in the exact same thing because I can still still what I entered on the terminal screen. What do you make of this.

user@mothership ~ $ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
user@mothership ~ $ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
user@mothership ~ $ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
user@mothership ~ $ sudo mysqld_safe --skip-grant-tables &
[2] 12970
user@mothership ~ $ 161206 19:37:50 mysqld_safe Logging to syslog.
161206 19:37:50 mysqld_safe A mysqld process already exists
mysql
ERROR 1698 (28000): Access denied for user 'user'@'localhost'
[2]+ Exit 1 sudo mysqld_safe --skip-grant-tables
user@mothership ~ $ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
user@mothership ~ $ sudo mysqld_safe --skip-grant-tables &
[2] 13151
user@mothership ~ $ 161206 19:38:35 mysqld_safe Logging to syslog.
161206 19:38:35 mysqld_safe A mysqld process already exists
mysql
ERROR 1698 (28000): Access denied for user 'user'@'localhost'
[2]+ Exit 1 sudo mysqld_safe --skip-grant-tables



I can launch mysql but only through sudo, check it out.

user@mothership ~ $ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
user@mothership ~ $ sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 32
Server version: 10.0.27-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

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)]>
 
1 members found this post helpful.
Old 12-07-2016, 01:24 AM   #26
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,357
Blog Entries: 11

Rep: Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320
Quote:
Originally Posted by Garrett85 View Post
I finally got the password changed and it stopped giving me all those errors not now mariadb will not let me login with `mysql -u root -p` I get access denied everytime even though I'm 100% sure I'm putting in the exact same thing because I can still still what I entered on the terminal screen. What do you make of this.

...


I can launch mysql but only through sudo, check it out.

user@mothership ~ $ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
user@mothership ~ $ sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor...
Well, that is progress of a sort!

I am a heavy MySQL/MariaDB user, but have never run into this behavior. I also am not an Ubuntu (or derivative) user, which might be the actual problem...

I found this post which sounds like your problem...

Quote:
So you've gone from version 5.5.44-1ubuntu0.14.04.1 to 10.0.20-0ubuntu0.15.04.1. Sounds scarier than it is, that's just what they called 5.6 for some reason.

It seems that newer versions of MariaDB have added a plugin to the user table to force authentication through a fixed path. In this case, the root database user is forced through the unix_socket plugin. This also seems to be known as auth_socket in some circles.
This and a few other refs I found indicate that it my be configured to disallow non-root users from logging in with mysql -u root. This seems to be determined by an entry in your my.cnf (or under /etc/my.cnf.d/...) something like this...

Code:
[mysql] update user set plugin='xxxx' where User='root';
Apparently, you can disable that behavior by removing this line, or setting the plugin= value to NULL.

However, if that is now the default behavior for your distro, you would probably be better off just adapting to it - make yourself a note!

Last edited by astrogeek; 12-07-2016 at 01:39 AM. Reason: added to quote
 
1 members found this post helpful.
Old 12-07-2016, 09:40 PM   #27
Garrett85
Member
 
Registered: Jan 2011
Posts: 280

Original Poster
Rep: Reputation: 5
I reinstalled the system again with a new Mint 18 image file and this time I also started with MySQL from the get go instead of MariaDB. Everything is working perfectly now. What you mentioned above is probably correct, I have never had so many problems with MySQL or MariaDB on past version of Mint. I think they changed MariaDB for Mint 18 and that change also corrupted MySQL installs from working after MaraiDB had been installed, so If you weren't aware of this plugin or what to do about it and happened to install MariaDB first, you were screwed. Thanks so much for all of your help.
 
Old 12-07-2016, 11:09 PM   #28
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,357
Blog Entries: 11

Rep: Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320Reputation: 3320
You are very welcome!

I also learned from the experience, now entered into my knowledge base!

Good luck!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] centos 5.5 need to reset gui password not the root password jmiller Linux - Newbie 9 01-10-2015 06:40 PM
LXer: How to reset a root password in MariaDB on Linux LXer Syndicated Linux News 0 06-18-2014 03:51 AM
Freenode webchat invalid password msg - How to reset freenode password? codeslayer2010 General 1 02-01-2013 07:31 PM
Linux 2.6.15.1 The password lost , RESET PASSWORD ANDYCHAN Linux - General 2 08-18-2012 09:05 AM
How to retrieve( or reset) root password in Mandrake Linux, as I forgot my password? Reghunath Linux - Software 4 05-08-2008 05:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:02 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration