MySql57 no .mysql_secret after install

How I recover my password?

Stop MySQL:
# service mysql-server stop

Start MySQL with --skip-grant-tables parameter:
# mysqld_safe --skip-grant-tables &

Start MySQL with -u root parameter:
# mysql -u root

Reset password:
UPDATE user SET Password=PASSWORD('[password]') WHERE User='[username]';

Restart MySQL:
# mysql-server restart

Enter with your new password:
# mysql -u root -p

Update: disable --skip-grant-tables parameter after all:
# mysql -u root -p
FLUSH PRIVILEGES;
 
Stop MySQL:
# service mysql-server stop

Start MySQL with --skip-grant-tables parameter:
# mysqld_safe --skip-grant-tables &

Start MySQL with -u root parameter:
# mysql -u root

Reset password:
UPDATE user SET Password=PASSWORD('[password]') WHERE User='[username]';

Restart MySQL:
# mysql-server restart

Enter with your new password:
# mysql -u root -p

Update: disable --skip-grant-tables parameter after all:
# mysql -u root -p
FLUSH PRIVILEGES;

not sure what I am doing wrong but everytime i hit enter it generates an error

root@rancid:/var/db/mysql # service mysql-server stop
Stopping mysql.
Waiting for PIDS: 12266.
root@rancid:/var/db/mysql # mysqld_safe --skip-grant-tables &
[1] 12807
root@rancid:/var/db/mysql # 2023-04-06T21:00:48.6NZ mysqld_safe Logging to '/var/db/mysql/rancid.err'.
2023-04-06T21:00:48.6NZ mysqld_safe Starting mysqld daemon with databases from /var/db/mysql

root@rancid:/var/db/mysql # mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.40-log Source distribution

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> UPDATE user SET Password=PASSWORD('[abcdefg]') WHERE User='[root]';
ERROR 1046 (3D000): No database selected
root@localhost [(none)]>
 
Select mysql database:
USE mysql;

and then run reset password command:

another error

t@localhost [(none)]> USE mysql;
Database changed
root@localhost [mysql]> UPDATE user SET Password=PASSWORD('[abcdefg]')
WHERE User='[root]';
ERROR 1054 (42S22): Unknown column 'Password' in 'field list'
root@localhost [mysql]>
 
MySQL 5.7 uses authentication_string column instead of Password column.
I think if you run the above command the problem will be solved.
 
MySQL 5.7 uses authentication_string column instead of Password column.
I think if you run the above command the problem will be solved.

ok that worked

Thanks for all your help. It would have taken forever to find those commands. Somebody need to update the pkg notes

Thanks again
 
Back
Top