Linux error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) (using password: YES)

Resetting password to solve MySQL for Linux error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

#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:

Save the document and exit:

#:wq
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

#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:

Save the document and exit:

#:wq
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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325204164&siteId=291194637