LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-15-2018, 11:54 AM   #1
SmaxBang
LQ Newbie
 
Registered: Nov 2018
Posts: 6

Rep: Reputation: Disabled
Question mysqld_safe: command not found


Hi, I am fairly new to Linux. I am running Fedora 28 on a VM for a class I am taking. I'm using the community-mysql-server but have forgotten my root password. I was trying to follow this guide: https://www.tecmint.com/reset-mysql-...root-password/ but have run into some issues.

When I try to run the mysqld_safe I get this error.
[root@localhost bin]# mysqld_safe --skip-grant-tables &
[1] 2944
[root@localhost bin]# -bash: mysqld_safe: command not found

I ran a whereis but only got this.
[root@localhost ~]# whereis mysqld_safe
mysqld_safe:
[root@localhost ~]#

I also looked in my /usr/bin/ directory but could not find any script in there named mysqld_safe. I read another forum post that suggested it could be named safe_mysqld but I was unable to find that too. Any help would be great thanks!
 
Old 11-15-2018, 12:49 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,700

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
Hi,

Read this for an explanation for the "mysqld_safe not found" error and what you can do to reset mysql root password in systemd.

Regards
 
1 members found this post helpful.
Old 11-15-2018, 01:31 PM   #3
SmaxBang
LQ Newbie
 
Registered: Nov 2018
Posts: 6

Original Poster
Rep: Reputation: Disabled
mysqld_safe: command not found

Thank you for your reply. However, I have encountered another issue.
I followed the instructions as the article said but it will not let me login without a password still.
[root@localhost ~]# systemctl stop mysqld
[root@localhost ~]# systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
 
Old 11-15-2018, 02:23 PM   #4
SmaxBang
LQ Newbie
 
Registered: Nov 2018
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
Hi,

Read this for an explanation for the "mysqld_safe not found" error and what you can do to reset mysql root password in systemd.

Regards
Additionally, I have also tried the following:
mysql -u root -e "UPDATE mysql.user SET authentication_string = PASSWORD('blank') WHERE User = 'root' AND Host = 'localhost';"

But I received the same error
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
 
Old 11-15-2018, 03:26 PM   #5
agillator
Member
 
Registered: Aug 2016
Distribution: Mint 19.1
Posts: 384

Rep: Reputation: Disabled
There is an outside chance you are actually using maridb since that is slowly replacing mysql in some distributions and the user often cannot tell the difference. On that outside chance try a simple
Code:
sudo mysql
. If it is mariadb that may let you in as root. If it isn't, then no harm done. Since it is a drop-in replacement, if you can't get your problem solved any other way you might backup the mysql data directories and then install mariadb. You may then be able to your data, or you may not but it is a chance. All of the commands are the same except that, without jumping through some hoops you sign in as root with sudo as above. Other users sign in the normal way.
Someone who knows more about systemd may be able to help you more than I without going through these gyrations, though.
 
Old 11-16-2018, 03:12 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,700

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
Quote:
Originally Posted by SmaxBang View Post
Thank you for your reply. However, I have encountered another issue.
I followed the instructions as the article said but it will not let me login without a password still.
[root@localhost ~]# systemctl stop mysqld
[root@localhost ~]# systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
It should work. Anyway, you can try the following alternatives:

1. If it's a new installation (i.e. there is no data entered, or it doesn't matter if you lose it), uninstall and reinstall mysql. Perhaps you'll have to delete (or move) /var/lib/mysql before reinstalling.

2. Start manually mysqld using the "--skip-grant-tables" option.
Run
Code:
ps -ef|grep mysqld
to see the options used by the daemon, stop it and then from command line, use the same options adding a "--skip-grant-tables &" at the end

3. Or you can try the solution from the official mysql documentation (see par. B.5.3.2.2 here)
 
Old 11-16-2018, 10:47 AM   #7
SmaxBang
LQ Newbie
 
Registered: Nov 2018
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thank you. I was able to get it after removing the /var/lib/mysql and reinstalling.
 
  


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] No package 'x11' found No package 'xext' found No package 'xdamage' found No package 'xfixes' found No package 'x11-xcb' found Jigsaw Linux From Scratch 12 04-25-2019 07:33 AM
[SOLVED] mysqld_safe error while booting slackware 13.1 tautvils Slackware 2 02-22-2011 06:32 AM
How to add mysqld_safe --user=mysql & in /etc/rc.d/rc.local Han_Nguyen Mandriva 11 07-16-2007 06:40 PM
mysqld_safe ends compu73rg33k Linux - Software 5 04-04-2004 04:23 PM
mysqld_safe & jakublgz Linux - General 1 02-21-2003 07:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:06 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