Bobcares

‘ERROR 1698’ MySQL error – 3 easy steps to solve this problem

by | Dec 18, 2018

When I try to login to MySQL database, I get some error message like “error 1698 (28000)”. Please help!

That was a recent support ticket received at our Server Support department where we resolve support queries for web hosts.

Website owners often face this error when they access the MySQL database as root user.

So, what’s the reason behind this? And, how to resolve this?

Today, we’ll discuss the reason for this error and how our Server Supported Engineers fix it.

 

‘error 1698’ MySQL error – What this means?

Before we move on to the reasons, let’s first get an idea of MySQL error ‘error 1698′.

Website owners face this error when MySQL disallows the root user to access the database.

For instance, users see the complete error message like this:

ERROR 1698 (28000): Access denied for user 'root'@'localhost'

 

In addition to that, website owners will not be able to connect to the database via a terminal, PHPmyadmin or MySQL client.

In our experience managing websites, majority of such complaints are raised by customers on a Ubuntu machine.

 

‘error 1698’ Mysql error – Causes and solutions

First, let’s see the main cause of this error identified by our Support Engineers during our debugging process.

Some systems like Ubuntu don’t use root password, instead Mysql root account is configured to use the auth_socket or unix_socket plugin for authentication.

mysql> USE mysql;
mysql> SELECT User, Host, plugin FROM mysql.user;

+------------------+-----------------------+
| User | plugin |
+------------------+-----------------------+
| root | auth_socket |
+------------------+-----------------------+

 

This plugin allows the user to use Operating System credentials when connecting to the database.

In other words, this plugin doesn’t care for password. It checks if the user is connecting via UNIX socket and then compares the username.

For example, a user authenticate to the Ubuntu system as test, so MySQL won’t trust the user when he login as root user, because this user is different from the system user test.

Result is ‘error 1698‘ Mysql error.

 

How we fix?

Now, let’s see how our Support Engineers fix this error.

1) Set root user to usemysql_native_password plugin

‘mysql_native_password’ implements authentication against mysql.user table using the native password authentication method.

So, the first solution our Hosting Engineers use, is to update the root user password and change the root user’s authentication plugin to ‘mysql_native_password’.

For example, we use the following command to change the root user’s authentication plugin to mysql_native_password.

user mysql;
update user set plugin='mysql_native_password' where User = 'root';

 

And, in order for the changes to reflect, and the privileges to be saved, we use the below command.

FLUSH PRIVILEGES;

 

[Need assistance in fixing MySQL errors in your website? Our MySQL experts can assist you. We are available 24/7.]

2) Add the system user to the MySQL ‘user’ table

Basically, mysql_native_password is the traditional method of authentication, but it isn’t secure, because it uses just a hash of the password.

So, the safe option that our Security Engineers always recommend is to add the system user to the MySQL user table with auth_socket plugin enabled.

For example, we use the following command to add the system user testing to the MySQL user table with the auth_socket plugin.

USE mysql;
CREATE USER 'testing'@'localhost' IDENTIFIED BY '';+
UPDATE user SET plugin='auth_socket' WHERE User='testing';

 

After that, we grant all privileges to this user, and flush the privileges for the changes to take effect.

Now, the user can login to MySQL with this system user.

 

3) Disable UNIX_socket authentication

Another simple solution to this problem is to disable UNIX socket authentication.

Our Hosting Engineers disable unix_socket authentication for root user using the following command.

use mysql;
update user set plugin='' where User='root';

 

Now, the root user can login with standard password authentication.

We’ve discussed 3 different ways to resolve this error.

Considering the security aspect, our MySQL experts always suggest server owners to follow the second step.

Because, it’s always good practice to create a new user and leave the root user there.

[Need a Mysql expert to look at this error? Our Dedicated Support Engineers can fix this for you within minutes.]

Conclusion

In short, ‘error 1698‘ Mysql error occurs due to the incorrect authentication plugin enabled for the root user. Today, we’ve discussed the 3 easy methods to solve this error and the most reliable solution suggested by our Server Support Engineers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

2 Comments

  1. Iradufasha Bikri

    This was really helpful, thanks a lot

    Reply
    • Hiba Razak

      Hi Iradufasha,
      Thanks for the feedback. We are glad to know that our article was helpful for you 🙂 .

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF