I am having centos 7 and recently i changed my data directory of mysql from /var/lib/mysql to /test/sql after the migration i am able to login from mysql server through terminal but not able to login through phpmyadmin says Cannot log in to the MySQL server without any error code. I tried flush privelage,creating news user with terminal and granting permission changing password of the account
1 Answer
After changing the data location of MySQL you also need to change the
phpmyadmin
settings accordingly to be able to login via phpmyadmin.
You need to reconfigure it to use socket authentication and point to the
new location of the mysql socket
If the new file system mounted under /data
, edit the file
/etc/phpMyAdmin/config.inc.php
(CentOS/RHEL) or
/etc/phpmyadmin/config.inc.php
(Ubuntu).
The data_type
is probably set currently to tcp
and needs to be changed to
socket
. Then set the new location of the socket:
$cfg['Servers'][$i]['socket'] = '/data/mysql/mysql.sock'; // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type'] = 'socket'; // How to connect to MySQL server ('tcp' or 'socket')
Restart Apache to apply the changes.
-
done your answer is Absolutely right buddy, I was working on it for hours and solved it just like that thanks Feb 10, 2021 at 12:02