0% found this document useful (0 votes)
970 views4 pages

Mysql - Mariadb - ERROR 1698 (28000) - Access Denied For User Root-Localhost - Stack Overflow

The user is unable to log into their MySQL database with the root user and gets an "Access denied" error. They checked the mysql.user table and root should have access. The issue arose after installing iRedMail on an Ubuntu server with Apache, MySQL, and PHP already set up. The solution outlined is that recent Ubuntu uses the auth_socket plugin by default for root, requiring system user credentials to log in. It provides two options: updating root to use mysql_native_password, or creating a new user for the system user.

Uploaded by

perexwi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
970 views4 pages

Mysql - Mariadb - ERROR 1698 (28000) - Access Denied For User Root-Localhost - Stack Overflow

The user is unable to log into their MySQL database with the root user and gets an "Access denied" error. They checked the mysql.user table and root should have access. The issue arose after installing iRedMail on an Ubuntu server with Apache, MySQL, and PHP already set up. The solution outlined is that recent Ubuntu uses the auth_socket plugin by default for root, requiring system user credentials to log in. It provides two options: updating root to use mysql_native_password, or creating a new user for the system user.

Uploaded by

perexwi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

5/2/2018 mysql - ERROR 1698 (28000): Access denied for user 'root'@'localhost' - Stack Overflow

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

So... I'm setting up a new server and keep running into this problem.

41 When I try to login to the MySQL database with the root user, I get the "ERROR 1698 (28000):
Access denied for user 'root'@'localhost'" error.

It doesn't matter if I connect through the terminal(SSH), through PHPMyAdmin or a MySQL Client,
e.g. Navicat. They all fail.

19 I looked in the mysql.user table and get the following:

+------------------+-------------------+
| user | host |
+------------------+-------------------+
| root | % |
| root | 127.0.0.1 |
| amavisd | localhost |
| debian-sys-maint | localhost |
| iredadmin | localhost |
| iredapd | localhost |
| mysql.sys | localhost |
| phpmyadmin | localhost |
| root | localhost |
| roundcube | localhost |
| vmail | localhost |
| vmailadmin | localhost |
| amavisd | test4.folkmann.it |
| iredadmin | test4.folkmann.it |
| iredapd | test4.folkmann.it |
| roundcube | test4.folkmann.it |
| vmail | test4.folkmann.it |
| vmailadmin | test4.folkmann.it |
+------------------+-------------------+

As you can see, root should have access.

The Server is quite simple, as I have tried to troubleshoot this for a while now..

https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost 1/4
5/2/2018 mysql - ERROR 1698 (28000): Access denied for user 'root'@'localhost' - Stack Overflow

It's running Ubuntu 16.04.1 LTS with Apache, MySQL and PHP, so that it can host websites, and
iRedMail 0.9.5-1, so that it can host mail.

Login in to the MySQL database works fine before I install iRedMail. I also tried, just installing
iRedMail, but then root, also doesn't work...

If someone could tell me how I fix my MySQL login problem or how I install iRedMail, on top of an
existing MySQL install. And yes I tried the Installation Tips and I can't find those variables in the
config files.

Any help is much appreciated :)

mysql iredmail

share improve this question asked Sep 1 '16 at 22:06


Folkmann
333 1 3 9

2 Thanks for listing all your user accounts and host names. If you could also provide some passwords,
that'd be really helpful. – Martin Parkin Sep 1 '16 at 22:07

It's local domains, so good luck connecting to them ;) Nothing but standard users from installing iRedMail,
so with minimal guesswork anyone would be able to know that those users exist om the system. –
Folkmann Sep 2 '16 at 13:51

I followed this link and the first option worked for me: askubuntu.com/questions/763336/… –
Mikael Arhelger Nov 28 '17 at 16:39

add a comment

5 Answers active oldest votes

The reason is that recent Ubuntu installation (maybe others also), mysql is using by default
the UNIX auth_socket plugin.
153
Basically means that: db_users using it, will be "auth" by the system user credentias. You can
see if your root user is set up like this by doing the following:

https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost 2/4
5/2/2018 mysql - ERROR 1698 (28000): Access denied for user 'root'@'localhost' - Stack Overflow

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;


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

+------------------+-----------------------+
| User | plugin |
+------------------+-----------------------+
| root | auth_socket |
| mysql.sys | mysql_native_password |
| debian-sys-maint | mysql_native_password |
+------------------+-----------------------+

As you can see in the query, the root user is using the auth_socket plugin

There are 2 ways to solve this:

1. You can set the root user to use the mysql_native_password plugin
2. You can create a new db_user with you system_user (recommended)

Option 1:

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;


mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;

$ service mysql restart

Option 2: (replace YOUR_SYSTEM_USER with the username you have)

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;


mysql> CREATE USER 'YOUR_SYSTEM_USER'@'localhost' IDENTIFIED BY '';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'YOUR_SYSTEM_USER'@'localhost';
mysql> UPDATE user SET plugin='auth_socket' WHERE User='YOUR_SYSTEM_USER';
mysql> FLUSH PRIVILEGES;
mysql> exit;

https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost 3/4
5/2/2018 mysql - ERROR 1698 (28000): Access denied for user 'root'@'localhost' - Stack Overflow

$ service mysql restart

Remember that if you use option #2 you'll have to connect to mysql as your system username
( mysql -u YOUR_SYSTEM_USER )

Note: On some systems (e.g., Debian stretch) 'auth_socket' plugin is called 'unix_socket', so the
corresponding SQL command should be: UPDATE user SET plugin='unix_socket' WHERE
User='YOUR_SYSTEM_USER';

https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost 4/4

You might also like