1

I installed phpMyAdmin on Ubuntu LAMP 18.04.

Now, when I visit /phpmyadmin/ and try to login with username root and the password that I set up when installing phpMyAdmin, I get the following error page:

enter image description here

I have a file in the directory etc/phpmyadmin/config-db.php which contains the following information:

$dbuser='root';
$dbpass='THE_PASSWORD';
$basepath='';
$dbname='phpmyadmin';
$dbserver='localhost';
$dbport='3306';
$dbtype='mysql';

I tried logging in using phpmyadmin as my username and I could get in. However, logging in as phpmyadmin does not give me enough privilege to create a database.

What should I do?

Thanks.

2

By default the root mysql user is restricted to disallow certain logins so for example in my environment on the command line issuing:

mysql -u root -p mysql

won't let me connect to the database, I would have to sudo:

sudo mysql -u root -p mysql

If you want to grant more privs to the phpmyadmin user then mysql logon as root and issue the relevant grant commands so for example the following gives the user all privs to all databases in all tables, including being able to grant privs to other users:

GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Of course you might not want that level of grant, you might want to only grant to certain databases/tables.

| improve this answer | |
  • Thanks @codlord. :) I was able to access the database using command line. However, I want to access it using a web interface by visitng /phpmyadmin/ in the browser. Is there a way to do that? Using root and my password does not work in the browser. – Real Noob May 13 at 19:09
  • 1
    I'm sure it's possible but it's not recommended to use the root user for front-end stuff, for security you want to be using a different user with the least-amount of privs needed. So I would suggest giving the phpmyadmin user whatever privs you need or create another user and give that privs. I don't know what you would do to make a root login possible via phpmyadmin as I've never done it. – codlord May 13 at 19:14
  • Thanks @codlord. I created a new user with a different password to login. It allowed me to create the database. – Real Noob May 13 at 19:16
  • is the user phpmyadmin created automatically? I don't remeber creating it. I was once asked some name so I entered phpmyadmin but I thought it was for the URL I need to type to access phpMyAdmin. :) – Real Noob May 13 at 19:17
  • Not that I know of, the phpmyadmin create_tables.sql creates the database and tables but not a user. The comments at the top say that it expects user "pma" to exist but I just run the create_tables.sql then created a phpmyadmin user and granted privs. – codlord May 13 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.