I'm using Ubuntu desktop 16.04 (upgraded from 15.10).
I had installed phpmyadmin from by apt-get install phpmyadmin
. It works if I go to localhost/phpmyadmin
but I cannot log into it as root.
I have searched a lot for it. I have found many sources in which they suggest to alter /etc/phpmyadmin/config.inc.php
and replace the user and password with 'root' and '' (empty for password). But my config.inc.php
is different from theirs. For example in my file, there is no line for user and password and it seems it gets it automatically from another file which is /etc/phpmyadmin/config-db.php
. Despite this, I have changed the user and password in that file, but now I get this error:
#1698 - Access denied for user 'root'@'localhost'
What I should do?
Phpmyadmin Version: 4.5.4.1deb2ubuntu1
mysql Ver 14.14 Distrib 5.7.12, for Linux (x86_64) using EditLine wrapper
MySQL 5.7 changed the secure model: now MySQL
root
login requires asudo
.I.e., phpMyAdmin will be not able to use
root
credentials.The simplest, safest and permanent solution will be create a new user and grant required privileges.
1. Connect to mysql
2. Create a real password
In the below steps I'll use
<please_replace_this>
as a sample password. PLEASE, REPLACE IT BY YOUR PASSWORD! DON'T USE<please_replace_this>
AS PASSWORD!3. Create a user for phpMyAdmin
Run the following commands (replacing
<please_replace_this>
by the desired password):If your phpMyAdmin is connecting to localhost, this should be enough.
4. Optional and unsafe: allow remote connections
Remember: allow a remote user to have all privileges is a security concern and this is not required in most of cases.
With this in mind, if you want this user to have the same privileges during remote connections, additionally run (replacing
<please_replace_this>
by the password used in Step #2):5. Update phpMyAdmin
Using
sudo
, edit/etc/dbconfig-common/phpmyadmin.conf
file updating user/password values in the following sections (replacing<please_replace_this>
by the password used in Step #2):If phpymadmin can't connect it may be due to the auth mechanism set to
auth_socket
. You can change it to use a regular password like this:I was struggling with this just now on a clean install of Ubuntu 18.04 and this is what made it work. There's a decent article here explaining more:
https://www.percona.com/blog/2016/03/16/change-user-password-in-mysql-5-7-with-plugin-auth_socket/
I was facing the same problem when using mariaDB with phpmyadmin (Ubuntu 16.04LTS).
Prerequisites:
1) Install MariaDB
If you want to uninstall
mariaDB
:2) Install phpmyadmin
3) In apache2, create a symbolic link to phpmyadmin
Ok, now, if you follow Rael's instructions, you'll be able to login into
phpmyadmin
, but, at least for me, I wasn't able to create new databases, as a red message came up:No privileges
(or some similar message)The fix was by reconfiguring phpmyadmin, and by answering some interactive questions.
Now if you try connect into phpmyadmin (
localhost/phpmyadmin
) usingyou'll be able to create databases.
In Ubuntu 16.04 for Mysql 5.7 check below table information and perform necessary settings:
Check if root is having auth_socket plugin then run below command:
For completeness, I've found a solution to my trouble in using MariadB version 10.1.23. The syntax to use in order to setup a new user is similar to one reported into the post above from @Rael Gugelmin Cunha, I put here my solution for reference to others facing same trouble:
Regards
I had the same problem, I've followed most the advice and none of it worked for me! My issue was the same when I opened http://localhost/phpmyadmin in my browser it asked for the log in details.
I was using root as user, and the password I knew was correct. And I was getting
All it took was to use
phpmyadmin
as user, notroot
, with the known password and it let me in.Referring to Rael Cunha:
Yes his solution works, and I have tried others. However, referring to a user having an exposed password on a configuration file like
/etc/dbconfig-common/phpmyadmin.conf
looks like a security flaw for a system-wide action.So I would rather suggest in what
MariaDB 10.1.x
is concerned (some_user and some_pass will be anything you may come up with):and leaving phpadmin setup (4) as is.
Log in to phpmyadmin with your own credentials afterwards
On my own setups I replace the above '%' by 'localhost' for security purposes, but if you have port 3306 closed on your server that would not necessarily present a security risk to you.
Only below code works for ubuntu 18.04, php 7 above and mysql 5.7
Do not replace 'phpmyadmin'. Creating any other user does not have full privilege like create new user, assign database privileges to that user like that. Only phpmyadmin user will gain full access.
if you install MySQL separate stop it by this command below sudo /opt/lampp/lampp stop service mysql stop sudo /opt/lampp/lampp start