0

When I go to localhost/phpmyadmin, it shows like this:

enter image description here

But how to set the username and password.

I have tried in the terminal:

mysql -u root -p

but it says:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

If I type username: root and password: [blank]

It shows me:

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
Twitter khuong291
  • 11,328
  • 15
  • 80
  • 116

1 Answers1

2

Try to search for a file called: config.inc.php in your system and open it with an editor of your choice.

Then either search for $cfg['Servers'][$i]['AllowNoPassword'] and set it to True: $cfg['Servers'][$i]['AllowNoPassword'] = TRUE; (Attention: use that only if you want to login without a password)

or if you want to login with a password(recommended) locate:

$cfg['Servers'][$i]['password'] and set your password like so:

$cfg['Servers'][$i]['password'] = 'your_password';
coder
  • 12,832
  • 5
  • 39
  • 53
  • Hi @coder, I open config.inc.php file, but I don't see `$cfg['Servers'][$i]['AllowNoPassword']` this line. – Twitter khuong291 Sep 25 '16 at 12:08
  • Hi @coder, I only see config.sample.inc.php, I don't see config.inc.php, but in config.sample.inc.php, I see this `$cfg['Servers'][$i]['AllowNoPassword']`. But when I set to true, it doesn't work. – Twitter khuong291 Sep 25 '16 at 12:19
  • @Khuong, config.sample.inc.php is just a minimal configuration file, and in your case if config.inc.php file is missing your will have to create one manually. To do that take a look at here: http://docs.phpmyadmin.net/en/latest/setup.html#manually-creating-the-file – coder Sep 25 '16 at 12:26
  • @Khuong, Also check if there is a file config.default.php and try to modify that file instead, as config.inc.php is not always required. – coder Sep 25 '16 at 12:30
  • So I should delete config.sample.inc.php and create new config.inc.php? – Twitter khuong291 Sep 25 '16 at 12:31
  • Hi @coder, I don't see config.default.php, maybe I need to redownload phpmyadmin again. – Twitter khuong291 Sep 25 '16 at 12:33
  • @Khuong, that is recommended as a clear installation may save you from custom fixing steps. Also consider some manuals on the internet about the setup so you won't have any problems in the configuration! – coder Sep 25 '16 at 12:35