Solved mysql_upgrade

the mysql_upgrade command (suggested by pkg after updating mysql version) produces this error
Code:
mysql_upgrade: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) while connecting to the MySQL server
Upgrade process encountered error and will not continue.

Web search brings up suggestions of resetting password with --skip-grant-tables, but the solutions seems like guesswork. If there's some default database, I'll nuke it or reset the password. But I don't recall setting one in the first place.

Does anyone have a suggestion?
 
the mysql_upgrade command (suggested by pkg after updating mysql version)
Only required if you do a version upgrade, from 5.6 to 5.7 for example. It's not needed for patch updates.

mysql_upgrade(1)
Code:
  •   --password[=password], -p[password] The password of the MySQL
           account used for connecting to the server. The password value is
           optional. If not given, mysql_upgrade prompts for one. If given,
           there must be no space between --password= or -p and the password
           following it. If no password option is specified, the default is to
           send no password.

But I don't recall setting one in the first place.
The initial setup does this automatically these days. Look for a ~/.my_password (or something to that extend, I can't remember the exact name) in root's home directory.

Edit: Looked it up on a system I had MySQL running, it's .mysql_secret.
 
Thanks, I found the secret file and the password in it. I deleted the file, restarted mysql and then mysql_upgrade worked fine.

🤘
 
Back
Top