Professional Documents
Culture Documents
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.
+------------------+-------------------+
| 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 |
+------------------+-------------------+
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.
mysql iredmail
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
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
+------------------+-----------------------+
| 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
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:
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
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