How to reset the root user password-if the root user password of the original MySQL database is forgotten, follow these steps: Step 1 in Windows. log on to windows as an administrator. use windows service management tools or task manager to stop MySQL service 3. create a single-line text file and save it as c: m
How to reset the root user password-if the root user password of the original MySQL database is forgotten, follow these steps: Step 1 in Windows. log on to windows as an administrator. use windows service management tools or task manager to stop MySQL service 3. create a single-line text file and save it as c: \ m
How to reset the root user password-if the root user root password of the original MySQL database is forgotten, you can restore it by following these steps:
Steps on Windows1. log on to windows as an administrator. use windows service management tools or task manager to stop MySQL service 3. create a text file FOR a single row and save it as c: \ mysql \ pwdhf.txt. The content is set password for 'root' @ 'localhost' = PASSWORD ('mynewpassword'); 4. open a console window and get the doscommand prompt 5. assume that your MySQL main directory is C:/mysql/bin, run c: \ mysql \ bin \ mysqld-nt -- init-file = c: \ mysql \ pwdhf.txt, if you are using the MySQL database server installed with the installation wizard, you need to use the service management tool to make changes. You need to find and add the default settings file, then run mysqld-nt -- defaults-file = "path \ my. ini "-- init-file = c: \ mysql \ pwdhf.txt 6. stop the MySQL database service and start mysql7again in normal mode. you can log on to the server normally.Steps in Unix1. log on to the system as root or as the user who starts the mysqld process. locate the file containing the Mysql service process number. pid. This file may be/var/lib/mysql/,/var/run/mysqld/,/usr/local/mysql/data/. The file name is generally "machine name. pid format. Run the command kill 'cat/mysql-data-directory // host-name.pid 'in the shell to end the mysql service process. create a single-line text file that can be named at will. Assume It is mysql-init and saved in the user's main directory ~ The file content is set password for 'root' @ 'localhost' = PASSWORD ('mynewpassword'); 4. restart mysql with the option. The specific command is mysqld_safe -- init-file = ~ /Mysql-init &, normally Delete the mysql-init file 5. You can use the new password to connect to the database.
General Solution
-Use the client interaction tool mysql to set the parameters as follows:
1. stop the mysql service and start the mysql service again with the -- skip-grand-table -- user = root option (the -- user = root option can be omitted in windows. use the client interaction tool mysql to connect to the server, and shell> mysql-u root3. run the following statement in the client interaction tool mysql: mysql> UPDATE mysql. user SET Password = PASSWORD ('newpwd')-> WHERE User = 'root'; mysql> flush privileges; 4. you can use newpwd as the password to log on to the server.
(51CTO. COM tutorial)