1. The first step in resetting the password is to skip the MySQL password authentication process, as follows:
#vim /etc/my.cnf (Note: my.ini is modified under windows)
Search for mysqld in the document to locate the [mysqld] text segment:
/mysqld (enter this command directly in the vim editing state to search for text content)
Add "skip-grant-tables" to any line after [mysqld] to skip the password verification process, as shown in the following figure:
2. Next we need to restart MySQL:
/etc/init.d/mysqld restart (some users may need to use /etc/init.d/mysqld restart)
3. After restarting, enter #mysql to enter mysql.
4. The next step is to use sql to modify the root password
mysql> use mysql;
mysql> update user set password=password("你的新密码") where user="root";
mysql> flush privileges;
mysql> quit
At this point, the root account has been reset to a new password.
======Import sql file============
1. Enter mysql
2.usr database
3.source /usr/local/data.sql