Ubuntu – Phptheadmin doesn’t connection with true data

18.04MySQLPHPphpmyadmin

I install mysql and phpmyadmin and in installation phpmyadmin i add config password is root but in connection with user is root and password is root i have this error

screenshot

Best Answer

I think the reason of the problem is that in Ubuntu 18.04 the default authentication method for the MySQL's root user is socket authentication. For example within the command line you can login as root by using sudo mysql instead of mysql -u'root' -p.

You can switch to mysql_native_password or even better you can create another user for web login and grant all privileges to this user. So let's assume the user you want to create is named webroot - you can create it by the following commands:

$ sudo mysql
mysql> CREATE USER 'webroot'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_strong_password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'webroot'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> exit;

References: