24

I have a root user in mysql-server on the Ubuntu server. I am unable to login to phpMyAdmin with the root user and password. I was trying to find the configuration file but could not locate it. Help would be appreciated.

sotirov
  • 4,379
user14010
  • 341

9 Answers9

17

I encountered a similar problem in Ubuntu 14.04 using MariaDB. Instead of trying to change everything I just created a new user.

mysql -u root -p

Entered the root password Created a new user using the following command:

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'some_very_complex_password';

Granted all permissions to newuser:

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

You can then log on using newuser in phpMyadmin. I would strongly encourage you to only grant specific privileges to newuser instead of Carte Blanche privileges but it's your own funeral.

lollilol
  • 3
  • 2
Garikai Dzoma
  • 336
  • 2
  • 7
16

You have to reconfigure phpMyAdmin, reset MySQL password:

  1. Reconfigure phpMyAdmin
  2. Ctrl+Alt+T to launch terminal
  3. sudo dpkg-reconfigure phpmyadmin
  4. Connection method for MySQL database for phpmyadmin: unix socket
  5. Name of the database's administrative user: root
  6. Password of the database's administrative user: mysqlsamplepassword (change this to your desired MySQL password)
  7. MySQL username for phpmyadmin: root
  8. MySQL database name for phpmyadmin: phpmyadmin
  9. Web server to reconfigure automatically: apache2
  10. ERROR 1045
  11. Ignore
  12. sudo dpkg-reconfigure mysql-server-5.5
  13. New password for the MySQL "root" user: mysqlsamplepassword (use the same password as in step 6)
  14. Repeat password for the MySQL "root" user: mysqlsamplepassword (use the same password as in steps 6 and 13)
sotirov
  • 4,379
8

To log in as root in phpmyadmin:

echo "UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root' AND plugin = 'unix_socket';FLUSH PRIVILEGES;" | mysql -u root -p

Found at the end of this tutorial

Worked for me :)

Zanna
  • 72,312
Ric
  • 81
4

Might for some reason the AllowRoot option be set to False? See the documentation.

B. Shea
  • 1,252
loevborg
  • 7,414
3

By "rootuser" you mean the MySQL root user, not the system root user, right?

During the installation of mysql-server, the MySQL root account is created and its password is stored in /etc/mysql/debian.cnf.

The configuration files of phpMyAdmin are stored in /etc/phpmyadmin.

Lekensteyn
  • 178,446
3

I installed MySQL using synaptic manager. Didn't have to enter a root password. The command:

mysqladmin -u root password NEWPASSWORD

worked. I was able to login into PhpMyAdmin immediately.

0

well , hello first download the phpmyadmin from here : https://www.phpmyadmin.net/downloads/

then extract the downloaded (rar,zip) to : {INSTILLATION_PATH }\laragon\etc\apps rename the folder to phpmyadmin .

now go to http://localhost/phpmyadmin

and your there :) .

if you want to login to the phpmyadmin you need to search in the phpmyadmin folder for a file called config.sample.inc and duplicate it and rename it to config.inc open the file and search for : $cfg['Servers'][$i]['AllowNoPassword'] = false; and set it to true : $cfg['Servers'][$i]['AllowNoPassword'] = true; save the file and DONE you can login using username of : root

divesh
  • 1
0

It seemed logical to me to keep things at the simplest level possible:

mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Thus phpmyadmin user which was created during the installation manages everything, including create databases.

0

I recently came across a very similar issue with Ubuntu 12.04. I just couldn't seem to login with root & no password. I set the AllowNoPassword setting to TRUE in the config. Later I found out that I was editing the wrong config.inc.php file to add the AllowNoPassword setting.

Edit:
/etc/phpmyadmin/config.inc.php
Not:
/usr/share/phpmyadmin/config.inc.php

I believe the first is the debian local config file, which will override the usr version.

jjwdesign
  • 320