Solution to MySql Error 1698 (28000)

Solution to MySql Error 1698 (28000)

1. Problem description:

MysqlERROR1698 (28000) solution, newly installed mysql-server-5.7, login to this problem, ordinary users can not enter mysql, only root users can enter, and no password is required.

~$ mysql -u root -p
Enter password: 
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

Second, the solution steps:

Stop mysql service

~$ sudo service mysql stop

Start MySQL in safe mode

~$ sudo mysqld_safe --skip-grant-tables &

After MySQL is started, you can log in without a password

~$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.10 MySQL Community Server (GPL)

Check the user table. The cause of the error is here. The root plugin has been changed to auth_socket, and the plugin for logging in with a password should be mysql_native_password.

mysql> select user, plugin from mysql.user;
+-----------+----------------------+
| user | plugin |
+-----------+----------------------+
| root | auth_socket |
| mysql.sys | mysql_native_password |
| dev | mysql_native_password |
+-----------+----------------------+
<strong>3</strong> rows in set (<strong>0.01</strong> sec)

There is an official description about auth_socket: https://dev.mysql.com/doc/mysql-security-excerpt/5.5/en/socket-authentication-plugin.html. Anyway, we won’t use it for now, so just change it here.

mysql> update mysql.user set authentication_string=PASSWORD('newPwd'), plugin='mysql_native_password' where user='root';
Query OK, <strong>1</strong> row affected, <strong>1</strong> warning (<strong>0.00</strong> sec)
Rows matched: <strong>1</strong> Changed: <strong>1</strong> Warnings: <strong>1</strong>
mysql> flush privileges;
Query OK, <strong>0</strong> rows affected (<strong>0.00</strong> sec)

Restart the service and the problem will be solved

~$ sudo service mysql stop
...
 * MySQL Community Server 5.7.10 is stopped
~$ sudo service mysql start
..
 * MySQL Community Server 5.7.10 is started
~$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.10 MySQL Community Server (GPL)

The above is the solution to the MySql Error 1698 (28000) problem introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • A simple way to change the password of mysql just installed in Linux
  • CentOS 6.6 source code compilation and installation of MySQL 5.7.18 tutorial detailed explanation
  • Solution to the problem that the number of MySQL connections is limited to 214 in CentOS 7
  • Analyzing the troublesome Aborted warning in MySQL through case studies
  • Solve the problem that IN subquery in MySQL will cause the index to be unusable
  • Detailed example of MySQL exchange partition

<<:  Installation of Docker CE on Ubuntu

>>:  JavaScript code to achieve a simple calendar effect

Recommend

Detailed explanation of viewing and setting SQL Mode in MySQL

Viewing and Setting SQL Mode in MySQL MySQL can r...

Introduction to the usage of exists and except in SQL Server

Table of contents 1. exists 1.1 Description 1.2 E...

Mini Program to implement Token generation and verification

Table of contents process Demo Mini Program Backe...

Detailed explanation of importing/exporting MySQL data in Docker container

Preface We all know that the import and export of...

Using radial gradient in CSS to achieve card effect

A few days ago, a colleague received a points mal...

The perfect solution for Vue routing fallback (vue-route-manager)

Table of contents Routing Manager background gett...

Vue implements a shopping cart that can change the shopping quantity

This article shares with you how to use Vue to ch...

Detailed explanation of the role of the new operator in Js

Preface Js is the most commonly used code manipul...

How to install Docker CE on Ubuntu 18.04 (Community Edition)

Uninstall old versions If you have installed an o...

Differentiate between null value and empty character ('') in MySQL

In daily development, database addition, deletion...

JS realizes the calculation of the total price of goods in the shopping cart

JS calculates the total price of goods in the sho...

How to query the minimum available id value in the Mysql table

Today, when I was looking at the laboratory proje...

Five ways to achieve automatic page jump in HTML

In the previous article, we introduced three comm...