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

MySQL Database Indexes and Transactions

Table of contents 1. Index 1.1 Concept 1.2 Functi...

About the use of Vue v-on directive

Table of contents 1. Listening for events 2. Pass...

Install mysql5.7.13 using RPM in CentOS 7

0. Environment Operating system for this article:...

How to use video.js in vue to play m3u8 format videos

Table of contents 1. Installation 2. Introducing ...

Serial and parallel operations in JavaScript

Table of contents 1. Introduction 2. es5 method 3...

Summary of MySQL InnoDB architecture

Table of contents introduction 1. Overall archite...

Introduction to Computed Properties in Vue

Table of contents 1. What is a calculated propert...

Linux bridge method steps to bridge two VirtualBox virtual networks

This article originated from my complaints about ...

Detailed steps to build a file server in Windows Server 2012

The file server is one of the most commonly used ...

my.cnf (my.ini) important parameter optimization configuration instructions

MyISAM storage engine The MyISAM storage engine i...

Summary of commonly used escape characters in HTML

The commonly used escape characters in HTML are s...

A brief talk about JavaScript variable promotion

Table of contents Preface 1. What variables are p...

Using an image as a label, the for attribute does not work in IE

For example: Copy code The code is as follows: <...