Change root password and restore MySQL tutorial root user
I accidentally deleted the MySQL root account. What am I going to do? "and" I lost my root password? This problem is met, then you touch this kind of problem is to back up the data, reinstall MySQL and restore all the database tutorial files? We'll find a better way for you now.
1, stop MySQL,
2, server Permissions
C:www.111cn.netbinmysqld-nt.exe--skip-grant-tables
Where c:www.111cn.net is MySQL ' instalation directory.
If it's Linux, execute the following command
/usr/local/mysql/bin/mysqld_safe--skip-grant-tables--user=root--skip-networking
3, connect to the server using the exsisting account (root or some otherif root account is deleted).
C:www.111cn.netbinmysql.exe-u User
Or
/usr/local/mysql/bin/mysql-u User
4, change the MySQL query password
Update Mysql.user set Password=password (' Newpwd ') where user= ' root ';
or recreating User:
Create user root identified by password ' newpwd ';
Grant all privileges on *. * to ' root ' @ ' localhost ' identified by ' newpwd ' with GRANT option Max_queries_per_hour 0 max_connections_per_hour 0 max_up Dates_per_hour 0 max_user_connections 0;
5, Refresh Permissions
Flush privileges;
6. Reboot the server
OK mysql root password you get back to the ha.