Error #1251 - Cannot log in to the MySQL server
Posted: 2019/06/20 10:18:23
I bought a VPS today to use as my new MySQL server. I installed MySQL, Apache, PHP, and phpMyAdmin. I set up my MySQL user as "admin". I am able to log into the user on the command-line, but not in phpMyAdmin. I get the error #1251 Cannot log in to the MySQL server.
The issue is on a new Linux VPS running CentOS 6, MySQL 8.0.16, and Apache 2.2.15. I have tried everything I came across in the past 6 hours of googling. I will create a list of everything I've tried since that will be easier to read.
config.inc.php
httpd.conf
phpMyAdmin.conf
my.cnf
After trying all of this, I have had no luck and I am still getting the same error #1251 Cannot log in to the MySQL server. Any help would be greatly appreciated at this point, as I am getting desperate.
The issue is on a new Linux VPS running CentOS 6, MySQL 8.0.16, and Apache 2.2.15. I have tried everything I came across in the past 6 hours of googling. I will create a list of everything I've tried since that will be easier to read.
- - setting bind-address to 127.0.0.1
- putting my username and password into config.inc.php
- setting the host to 127.0.0.1 in config.inc.php
- trying sockets over TCP (and setting the host to localhost when using sockets)
- creating a soft-link shortcut from `/usr/share/phpmyadmin` to `/var/www/html/phpmyadmin`
- reinstalling and running mysql_secure_installation
config.inc.php
Code: Select all
$cfg['Servers'][$i]['host'] = '127.0.0.1'; // MySQL hostname or IP address
$cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port
$cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket')
$cfg['Servers'][$i]['extension'] = 'mysqli'; // The php MySQL extension to use ('mysql' or 'mysqli')
$cfg['Servers'][$i]['compress'] = FALSE; // Use compressed protocol for the MySQL connection
// (requires PHP >= 4.3.0)
$cfg['Servers'][$i]['controluser'] = ''; // MySQL control user settings
// (this user must have read-only
$cfg['Servers'][$i]['controlpass'] = ''; // access to the "mysql/user"
// and "mysql/db" tables).
// The controluser is also
// used for all relational
// features (pmadb)
$cfg['Servers'][$i]['auth_type'] = 'cookie'; // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = 'admin'; // MySQL user
$cfg['Servers'][$i]['password'] = 'areallygoodpassword'; // MySQL password (only needed
Code: Select all
<IfModule php5_module>
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
</IfModule>
LoadModule php5_module modules/libphp5.so
AddType x-httpd-php .php
AddHandler php5-script .php
Code: Select all
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
Order Allow,Deny
Allow from All
</Directory>
Code: Select all
bind-address=127.0.0.1
After trying all of this, I have had no luck and I am still getting the same error #1251 Cannot log in to the MySQL server. Any help would be greatly appreciated at this point, as I am getting desperate.