1. First editing my.ini file
we /etc/my.cnf
2. Locate the following similar to the following, and fill out the skip-grant-tables
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock <strong>skip-grant-tables </strong>
保存并且退出vi。
随后重启mysql数据库,就可以免密码登录了
Start mysqld systemctl
3. Enter -uroot MySQL
4. access to the database, and select the current database MySQL
use MySQL;
5. The following SQL to change the password and
the UPDATE User the SET Password = password ( 'your password') the WHERE the User = 'the root';
6. refresh after editing permissions
flush privileges;
7.exit; exit the database; the best type exit to leave the database can, of course, after the changes are complete, remember to re-edit and delete my.ini we add the skip-grant-tables
again restart the database. In this way, we reset the password to complete it.
8. Re-enter the mysql -uroot -p try to enter a new password database
you're done! ! !
1. First editing my.ini file
we /etc/my.cnf
2. Locate the following similar to the following, and fill out the skip-grant-tables
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock <strong>skip-grant-tables </strong>
保存并且退出vi。
随后重启mysql数据库,就可以免密码登录了
Start mysqld systemctl
3. Enter -uroot MySQL
4. access to the database, and select the current database MySQL
use MySQL;
5. The following SQL to change the password and
the UPDATE User the SET Password = password ( 'your password') the WHERE the User = 'the root';
6. refresh after editing permissions
flush privileges;
7.exit; exit the database; the best type exit to leave the database can, of course, after the changes are complete, remember to re-edit and delete my.ini we add the skip-grant-tables
again restart the database. In this way, we reset the password to complete it.
8. Re-enter the mysql -uroot -p try to enter a new password database
you're done! ! !