15

I've already looked into this but since I am running on Ubuntu 10.04 instead of XAMPP and have already created the phpmyadmin database and I can log in through terminal with both the root and phpmyadmin users.

How I installed: sudo apt-get install lamp-server^ sudo apt-get install phpmyadmin

I can login locally on terminal using both the root and phpmyadmin users. I can view the phpmyadmin login page. A phpinfo.php page I posted to server works.

  • Ubuntu Version 10.04.4 Lucid Lynx
  • Apache 2.2.14
  • MySQL 5.1.73
  • PHP 5.3.6
  • Phpmyadmin 3.3.2
Community
  • 1
  • 1
Spitfire19
  • 260
  • 1
  • 2
  • 11

9 Answers9

12

Since you're able to log on as the controluser at the terminal, it's most likely that your configuration file doesn't contain the proper username or password for the controluser.

Open up config.inc.php in your text editor and look at the controluser and controlpass lines -- make sure they match exactly what username and password you're successfully using. Try commenting out those two lines completely to see if you get a different error message.

If you've used the package manager to install, note that the configuration files are spread about in /etc/phpmyadmin and if you manually added those lines, they might be overwritten by another configuration file. Try grep -Ri controluser /etc/phpmyadmin/* to see if that appears in more than one file.

Since you've used the package manager, you should let it handle configuring the database. Try removing any edits you've made to the configuration files and running dpkg-reconfigure -plow phpmyadmin (this is a shell command to run at the command prompt); this will reconfigure the phpmyadmin package and will ask if you want to allow dbconfig-common to create the phpMyAdmin tables for you as well as the controluser.

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
  • 1
    I went through your suggestions and it was very helpful. I double checked that I could login with: mysql -u phpmyadmin phpmyadmin -p Then I added the credentials to the config.inc.php page. Still failed. I have not changed 'connect_type' or 'port', they are default. – Spitfire19 Jul 17 '14 at 19:14
  • Did you allow `dbconfig-common` to configure your database? This should all happen automatically if you do. I've edited my answer, try the dpkg-reconfigure part. – Isaac Bennetch Jul 17 '14 at 21:26
  • What happened when you ran dpkg-reconfigure? Did you get the dialog asking whether you want to allow dbconfig-common to configure the database? Did it give another error message? – Isaac Bennetch Jul 21 '14 at 18:59
  • Going from memory here since the computer is now off doing it's job. I did get said dialog clicked yes to re-configure database. Tried a few times, normally I would set it up to listen on UNIX Socket and the re-configurer was always able to log in. MySQL is set to default settings (excluding passwords of course), but I knew all those and had terminal access to MySQL on local computer. – Spitfire19 Jul 21 '14 at 21:24
  • I solved it by changing `dbuser` from `phpmyadmin` to `root` in `config-db.php` file. – Gautam Arya Jan 19 '15 at 07:07
  • 4
    `dpkg-reconfigure -plow phpmyadmin` solved it for me since I messed up the installation via `sudo apt-get install phpmyadmin` through wrong input, therefore phpmyadmin wasn't able to connect to the DB and setup their initial structure. – Dominic Jun 24 '15 at 09:13
  • `-plow` used with accepted answer was the solution for phpmyadmin + phpbrew. – versedi Jan 26 '16 at 14:23
10

Just uncomment the line:

$cfg['Servers'][$i]['host'] = 'localhost';

Try it.

bhansa
  • 7,282
  • 3
  • 30
  • 55
6

Possible problem: updated mySQL user

This can also happen when the user you are connecting as in phpmyadmin has been updated in mySQL. I just had this when uninstalling/updating/reinstalling phpmyadmin and changing some mySQL settings at the same time.

Fix for this problem: update config-db.php

The fix is to go update the config-db.php file with the proper login credentials (username, password, etc.)

In Ubuntu 12.04, this is located at /etc/phpmyadmin/config-db.php.

Some more detailed instructions are at http://tehnoblog.org/phpmyadmin-error-connection-for-controluser-as-defined-in-your-configuration-failed/

SRDC
  • 170
  • 3
  • 7
4

I have successfully connected by switching the protocol to tcp and connecting to '127.0.0.1' instead of 'localhost'. Still cannot connect via Unix Socket though even though the MySql daemon socket is running.

Spitfire19
  • 260
  • 1
  • 2
  • 11
  • Definitely something wrong with your mysql settings, should check it for the socket lock file setting. – ImLeo Mar 16 '16 at 23:19
3

create a database phpmyadmin

Open file

  /etc/phpmyadmin/config-db.php

set the root password in config-db.php file.

$dbuser='root';
$dbpass='password'; // set current password between quotes ' '
$basepath='';
$dbname='phpmyadmin';
$dbserver='';
$dbport='';
$dbtype='mysql';

issue will be resolved.

Vipin Singh
  • 532
  • 1
  • 7
  • 24
2

There are 2 errors:

1. Connection for controluser as defined in your configuration failed
Solution:
a. Open terminal: sudo gedit /etc/phpmyadmin/config.inc.php

b. and uncomment following lines(may be both will come 2 times depend upon version): $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

c. and comment following lines(may be both will come 2 times depend upon version): //$cfg['Servers'][$i]['controluser'] = $dbuser; //$cfg['Servers'][$i]['controlpass'] = $dbpass;

2. Access denied for user 'root'@'localhost'

This will come when you open phpmyadmin or when you open mysql on terminal with out sudo command(not from root user). This error is due to root user. The reson behind this error is your current ubuntu user does not have previlages to open mysql in terminal. If you open mysql with sudo command then it will open but not open from your current user. For example:

lenovo@lenovo-ThinkPad-E460:/etc$ mysql -u root -p Enter password: ERROR 1698 (28000): Access denied for user 'root'@'localhost'

Here current ubuntu user is lenovo. So you have to give permissions to your root user. Process:

1 - First, connect in sudo mysql

sudo mysql -u root

2 - Check your accounts present in your db

SELECT User,Host FROM mysql.user;

+------------------+-----------+
| User             | Host      |
+------------------+-----------+
| admin            | localhost |
| debian-sys-maint | localhost |
| magento_user     | localhost |
| mysql.sys        | localhost |
| root             | localhost |

3 - Delete current root@localhost account

mysql> DROP USER 'root'@'localhost'; Query OK, 0 rows affected (0,00 sec)

4 - Recreate your user

mysql> CREATE USER 'root'@'%' IDENTIFIED BY ''; Query OK, 0 rows affected (0,00 sec)

5 - Give permissions to your user and don't forget to flush privileges

mysql> GRANT ALL PRIVILEGES ON . TO 'root'@'%'; Query OK, 0 rows affected (0,00 sec)

mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0,01 sec)

6 - Exit mysql and try to reconnect without sudo

I hope this will help. And now you able to open phpmyadmin with no password.

alok
  • 2,718
  • 21
  • 17
1

First of all make sure that you have the correct username & password in this file:

/etc/dbconfig-common/phpmyadmin.conf

As stated in /etc/phpmyadmin/config-db.php:

## database access settings in php format
## automatically generated from /etc/dbconfig-common/phpmyadmin.conf
## by /usr/sbin/dbconfig-generate-include

This username & password are used for accessing the phpmyadmin database.
Thus, phpmyadmin database should have a user with the same name & password assigned to it with at least Database-specific privileges

That solved it for me....

On:

  • Server: Localhost via UNIX socket
  • Server type: MySQL
  • Server version: 5.7.16 - MySQL Community Server (GPL)
Jadeye
  • 3,551
  • 4
  • 47
  • 63
0

If you are on windows with xammp go to C:\xammp\phpMyAdmin\ config.inc, open it and locate this line, now make sure

/* User for advanced features*/
$cfg['servers'][$i]['controluser'] = 'pma';
$cfg['servers'][$i]['controlpass'] = '';

and user pma username and password in the phpMyAdmin database are the same

Read the phpmyadmin documentation

William Desportes
  • 1,412
  • 1
  • 22
  • 31
  • 1
    Please consider editing your post to add more explanation about what your code does and why it will solve the problem. An answer that mostly just contains code (even if it's working) usually wont help the OP to understand their problem. – SuperBiasedMan Oct 01 '15 at 15:16
0

In my case I use a socket connection. By setting $cfg['Servers'][$i]['controlhost'] = ''; (so to empty) the message 'Connection for controluser as defined in your configuration failed' disappeared. I think the reason is that if you set the 'controlhost' phpMyAdmin tries make a new connection to the database thereby neglecting the socket.

In the code you find:

          if (! empty($cfg['Server']['controlhost'])
            || ! empty($cfg['Server']['controlport'])

At the end of the if block a new connection is made.

jvenderb
  • 1
  • 1