Resetting the Root Password: Generic Instructions
mysql-server stop
Instead of blindly following some commands, stop to think what they actually do. Is it really useful to send a kill to a process that's already stopped?How can I send the kill comand to mysqld ???????
Is it really useful to send a kill to a process that's already stopped?
No, it's not wrong. You just used a different way of stopping the MySQL process.Probably it'is wrong the documentation.
Resetting the Root Password: Generic Instructions
You are not following the instructions that i send you at my first post.
service mysql-server stop
sysrc mysql_args="--skip-grant-tables"
service mysql-server start
mysql -u root
> ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
> exit
service mysql-server stop
sysrc -x mysql_args
service mysql-server start
What means login without a password.Login without a password
The whole thing:
> ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
At the finish of the installation process is visualized a clear message about the use of a temporary password stored in the directory ./HOME/.mysql_secrete fileThere's no temporary password.
shell> mysql
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
Ok Vladi ....1. Stop the MySQL server if necessary, then restart it with the --skip-grant-tables option. This enables anyone to connect without a password and with all privileges, and disables account-management statements such as ALTER USER and SET PASSWORD. Because this is insecure, if the server is started with the --skip-grant-tables option, it enables --skip-networking automatically to prevent remote connections.
/usr/local/libexec/mysqld [URL='https://dev.mysql.com/doc/refman/8.0/en/server-options.html#option_mysqld_skip-grant-tables']--skip-grant-tables[/URL]
mysql_enable="YES"
Surely I'm an idiot.If you have clean install of mysql you don't have password so you can just login as root and set your new password.
If you have clean install of mysql you don't have password so you can just login as root and set your new password
login: root
password: toor
root@maya:# mysql -u root -p
Enter password: toor (obviously it is not visible)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 25338 to server version: 8.0.13-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
root% pkg install mysql57-server
root% service mysql-server onestart
root% mysql -u root -p
Enter password:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
Type in password given in /root/.mysql_secret file, and connection to server is complete.
--skip-grant-tables
option does not work and I would never have noticed that auto-generated /root/.mysql_secret
file. It's in the port installation messageMessage from mysql57-server-5.7.27:
--
Initial password for first time use of MySQL is saved in $HOME/.mysql_secret
ie. when you want to use "mysql -u root -p" first you should see password
in /root/.mysql_secret
Login without a password, the --skip-grant-tables basically disables authentication/authorization. Allowing you to login without a password.
The whole thing:
Code:service mysql-server stop sysrc mysql_args="--skip-grant-tables" service mysql-server start mysql -u root > ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword'; > exit service mysql-server stop sysrc -x mysql_args service mysql-server start
You need to restart MySQL in any case, or else that --skip-grant-tables would still be active. Restarting MySQL will automatically flush the privileges.However, if someone else comes across this, you need to run FLUSH PRIVILEGES; after mysql -u root.
/usr/local/etc/rc.d/mysql-server onestart or /usr/local/etc/rc.d/mysql-server start
/usr/local/bin/mysql_secure_installation
ALTER USER 'root'@'localhost' IDENTIFIED BY 'NEWPASSWORDGOESHERE';