5

I was resetting MYSQL Password since I forgot it. I am using MYSQL 5.6.41 at Centos 7.

I followed the following steps:

  1. Stop MYSQL using :

service mysql stop

  1. Start MYSQL in safe mode so that I can have full access without a password.

sudo mysqld_safe --skip-grant-tables &

Above command ends with :

190822 20:37:38 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

[1]+  Done         mysqld_safe --skip-grant-tables
  1. Check MYSQL status if it is running:

service mysql status

This command always shows me iactive status:
 Active: inactive (dead) since Thu 2019-08-22 20:14:22 UTC; 11min ago

Since MYSQL is getting dead after running mysqld_safe, 'mysql -u root' is denying to login.

I visited many links to solve this problem even I found the same problem posted by a couple of people but that did not work in my case.

Reference :

https://linuxize.com/post/how-to-reset-a-mysql-root-password/

Can't reset root password with --skip-grant-tables on ubuntu 16

mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid prevent from server restart

Shishupal Shakya
  • 1,632
  • 2
  • 18
  • 41

2 Answers2

2

Finally, I solved it using the following link and some modifications in the commands used in it.

Resetting the Root Password: Unix and Unix-Like Systems

Modifications I did:

  1. Stop MYSQL Server (Didn't work in my case)

kill cat /mysql-data-directory/host_name.pid

I used: > service mysqld stop

  1. Start the MySQL server with the init_file system variable set to name the file (Did not work in my case):

mysqld --init-file=/home/me/mysql-init &

I used:

mysqld --init-file=/home/me/mysql-init.txt &

Shishupal Shakya
  • 1,632
  • 2
  • 18
  • 41
0

After search some hours without succcess, I finally find the way

When you execute

sudo mysqld_safe --skip-grant-tables &

Mysql use a file in /etc/mysql/mysql.conf.d/mysqld_safe_syslog.cnf

I comment the second line, and save like this

[mysqld_safe]
#syslog

Then I can execute the command without problems. I have found in log /var/log/mysql/error.log

This error:
    [ERROR] [MY-000067] [Server] unknown variable 'log-syslog=1'.
    [ERROR] [MY-010119] [Server] Aborting

And search on internet what is this variable. https://dba.stackexchange.com/questions/230736/mysql-could-not-be-started-because-unknown-variable-log-syslog-1

Dharman
  • 30,962
  • 25
  • 85
  • 135
martincito
  • 389
  • 4
  • 10