There are situations when the administrator cannot connect to the server. This happens because the user password has been forgotten, or the wrong value has been assigned to it during the change. In such cases, it is required to regain control over the server and set a new password.
It is necessary
Server technical documentation
Instructions
Step 1
We shutdown the server. To do this, log in as the root user on the server computer and exit with the kill command.
Step 2
We use the kill-9 command if the server does not respond to the shutdown signal. This command is for forced closure, but do not rush to use it, as there is a risk of table corruption.
Step 3
We check the tables with the commands myisamchk and isamchk. In each case, you should use the technical documentation, in particular from the section "Maintaining and restoring the database", to determine the correctness of closing the tables. You must complete this procedure before the next start of the server.
Step 4
Restart the server using the -skip-grant-tables option. This prevents the server from using permission tables when checking connections. Thus, it is possible to connect to the server as a root user with privileges enabled without entering a password.
Step 5
Restart the server with the --skip-grant-tables option, but in a slightly different way than in Step 4. go to /etc/init.d and type the command - mysqld stop. Then we start it mysqld ---- skip-grant-tables. After that, set a new password for the server: mysqladmin -h host -u. Enter your username and new password. Reboot using permission tables support.