Connection for controluser as defined in your configuration failed
Asked Answered
I

9

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
Itch answered 17/7, 2014 at 15:5 Comment(3)
Oh, and I Granted ALL permissions to root and phpmyadmin to the MySQl server.Itch
Have you installed phpMyAdmin manually or from the package (dpkg/apt/aptitude/etc?Colliery
I installed from package.Itch
I
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.

Itch answered 21/7, 2014 at 14:26 Comment(1)
Definitely something wrong with your mysql settings, should check it for the socket lock file setting.Mccormac
C
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.

Colliery answered 17/7, 2014 at 18:30 Comment(7)
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.Itch
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.Colliery
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?Colliery
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.Itch
I solved it by changing dbuser from phpmyadmin to root in config-db.php file.Maxim
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.Plast
-plow used with accepted answer was the solution for phpmyadmin + phpbrew.Judgment
W
10

Just uncomment the line:

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

Try it.

Wynnie answered 23/8, 2015 at 11:32 Comment(3)
I no longer have the project available but it sounds like it would work.Itch
Worked. Anyone explain why it worked when the issue seems to be with the controluser?Hydropathy
I had uncommented the line, refreshed my browser. Problem disappeared. Commented again. and still disappeared. :|Septillion
M
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/

Mascot answered 17/3, 2016 at 2:12 Comment(1)
change the $dbuser to root and leave $dbpass blank is working for me, thanks!Muster
I
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.

Itch answered 21/7, 2014 at 14:26 Comment(1)
Definitely something wrong with your mysql settings, should check it for the socket lock file setting.Mccormac
I
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.

Insecticide answered 13/6, 2017 at 18:54 Comment(0)
G
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.

Grizzly answered 8/12, 2016 at 7:30 Comment(1)
This was the best solution for me! ThanksAnnouncement
D
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)
Dam answered 3/11, 2016 at 17:2 Comment(0)
P
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

Porism answered 1/10, 2015 at 14:53 Comment(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.Herzegovina
O
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.

Oshinski answered 5/2, 2016 at 14:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.