Spitfire19
Spitfire19

Reputation: 380

Connection for controluser as defined in your configuration failed

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.

Upvotes: 15

Views: 104050

Answers (9)

Fidel Mordzinu
Fidel Mordzinu

Reputation: 83

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

Upvotes: 0

bhansa
bhansa

Reputation: 7514

Just uncomment the line:

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

Try it.

Upvotes: 10

Vipin Singh
Vipin Singh

Reputation: 552

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.

Upvotes: 3

alok
alok

Reputation: 2756

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.

Upvotes: 2

Jadeye
Jadeye

Reputation: 4329

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)

Upvotes: 1

SRDC
SRDC

Reputation: 170

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/

Upvotes: 6

jvenderb
jvenderb

Reputation: 1

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.

Upvotes: 0

Spitfire19
Spitfire19

Reputation: 380

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.

Upvotes: 4

Isaac Bennetch
Isaac Bennetch

Reputation: 12442

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.

Upvotes: 12

Related Questions