Easy Hosting Control Panel (EHCP) :: Force Edition

EHCP Force Support => Technical Help => Topic started by: NukeSter on November 05, 2014, 11:12:26 am

Title: PHPMyAdmin - Can't Login As root User
Post by: NukeSter on November 05, 2014, 11:12:26 am
After doing the most recent update root password no longer works in phpmyadmin could you please lookin to fixing this as i have gone to zpanel for till this problem can be fixed
Title: Re: phpmy admin
Post by: earnolmartin on November 06, 2014, 07:02:21 pm
After doing the most recent update root password no longer works in phpmyadmin could you please lookin to fixing this as i have gone to zpanel for till this problem can be fixed

This is a new security feature to make it harder for your server to be hacked.  You need to whitelist your IP address by doing the following:

Code: [Select]
sudo -i
sed -i "s#^include_once 'rootip_whitelist_functions.php';#include_once '/usr/share/phpmyadmin/rootip_whitelist_functions.php';#g" "/etc/phpmyadmin/config.inc.php"
sed -i "s#^include 'rootip_whitelist.php';#include '/usr/share/phpmyadmin/rootip_whitelist.php';#g" "/etc/phpmyadmin/config.inc.php"
cd /usr/share/phpmyadmin/
nano rootip_whitelist.php

From the computer you are using to access PHPMyAdmin, browse to www.grabip.tk (http://www.grabip.tk) to get your IP address.  Write it down.

Now, while editing the rootip_whitelist.php file, find the line of:

Code: [Select]
// IP Addresses that are allowed to login via the root MySQL account through PHPMyAdmin
$allowedIPs = array("127.0.0.1");

Add your IP address to the array.  It should look something like this:

Code: [Select]
// IP Addresses that are allowed to login via the root MySQL account through PHPMyAdmin
$allowedIPs = array("127.0.0.1", "1.1.1.1");

In the example above, the IP address of 1.1.1.1 was used.  Replace that value with the one you found from http://www.grabip.tk.

Save the file.  You can now login as the root user from that machine. 

In general, you should not login as the root user from an insecure connection.  The root mysql user account is very important to keep secure.

To DISABLE this Feature Completely and Allow root Logins via PHPMyAdmin:

If you want to allow the MySQL root user to login via PHPMyAdmin, simply run the following command:
Code: [Select]
sudo sh -c "echo \"<?php \\\$cfg['Servers'][1]['AllowRoot'] = TRUE?>\" >/usr/share/phpmyadmin/rootip_whitelist.php"

If you DO NOT want the root user to login using PHPMyAdmin from any IP address, simply clear the file by running this command:
Code: [Select]
sudo sh -c ">/usr/share/phpmyadmin/rootip_whitelist.php"

Updates and upgrades will not overwrite the rootip_whitelist.php file even if it's empty.
Title: Re: PHPMyAdmin - Can't Login As root User
Post by: NukeSter on November 07, 2014, 11:23:53 am
Thank you very much for your response, I need to be able to access root so I can setup remote database for my game servers.
Title: Re: PHPMyAdmin - Can't Login As root User
Post by: earnolmartin on November 10, 2014, 10:29:07 pm
I updated my previous response with a command you can run to enable logging in as the root user in PHPMyAdmin.
Title: Re: PHPMyAdmin - Can't Login As root User
Post by: NukeSter on December 08, 2014, 12:39:56 pm
worked perfectly thank you  :)
Title: Re: PHPMyAdmin - Can't Login As root User
Post by: earnolmartin on December 09, 2014, 09:01:18 pm
Cool, thanks for letting me know that it worked.
Title: Re: PHPMyAdmin - Can't Login As root User
Post by: Loren Tedford on February 19, 2016, 07:42:40 pm
I do not thing the above works anymore having issues with logging in now as root on a fresh install of EHCPforce
Title: Re: PHPMyAdmin - Can't Login As root User
Post by: earnolmartin on February 21, 2016, 05:06:35 pm
I do not thing the above works anymore having issues with logging in now as root on a fresh install of EHCPforce

Which version of Ubuntu?  Did you run the script posted above?

What are the file contents of /usr/share/phpmyadmin/rootip_whitelist.php?

Code: [Select]
sudo cat /usr/share/phpmyadmin/rootip_whitelist.php
Title: Re: PHPMyAdmin - Can't Login As root User
Post by: Colin on June 29, 2018, 03:28:17 am
I can't log into MySQL root either after fresh install of Ubuntu 18.04 and EHCP Force (Latest) with or without unattended install.
I can log in to the database in terminal so the password is correct, i can create and delete databases withing EHCP Console
so it seams EHCP is set up correctly but what ever i do including instructions on this thread MySQL root can not be logged into.
I need to beable to log into root as some DB's i have need to be set up within root.

Another strange thing: If i set up a second root password...  ie  admin then i can log in to MySQL and do as i need  BUT
then i can NOT create and delete databases withing EHCP Console.

Any assistance please, i really need to get on and build my databases back up to as they where.
Title: Re: PHPMyAdmin - Can't Login As root User
Post by: earnolmartin on July 01, 2018, 11:32:17 pm
I'll see if I can reproduce this issue on Ubuntu 18.04. 
Title: Re: PHPMyAdmin - Can't Login As root User
Post by: earnolmartin on July 05, 2018, 09:21:44 pm
Fix has been implemented.

In addition to the commands in the first post, you need to run these as well if you're having problems:

Code: [Select]
sudo -i
sed -i "s#^include_once 'rootip_whitelist_functions.php';#include_once '/usr/share/phpmyadmin/rootip_whitelist_functions.php';#g" "/etc/phpmyadmin/config.inc.php"
sed -i "s#^include 'rootip_whitelist.php';#include '/usr/share/phpmyadmin/rootip_whitelist.php';#g" "/etc/phpmyadmin/config.inc.php"

https://github.com/earnolmartin/EHCP-Force-Edition/commit/7509e193cc16dbe9757739d16ec1465009230dd8

To have the fix implemented automatically via an update, follow these instructions:

http://ehcpforce.tk/download.php#svn-version under the "Update to Latest Code (Developer Version)"