Thursday, May 24, 2018

phpmyAdmin and MySQL Server

This happened to me, when I installed mysql-server then install phpmyadmin, I face this problem when accessing the address localhost/phpmyadmin: "mysqli_real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'" and "#1698 - Access denied for user 'root'@'localhost'"

this happened because the new configuration of mysql-server and phpmyadmin, for security reason, do not allow root user to access remotely by default.

try this steps:

  1. configure the mysql-server, add a new user "pma" (phpMyAdmin) or "pmauser"
    1. login to your mysql console using terminal:
      mysql -u root -p
    2. insert your root password
    3. execute this commmand, change the 'yourpassword' to preferred one:
      Create user 'pmauser'@'%' identified by 'yourpassword';
    4. make sure that your new user had been created:
      select host, user, authentication_string from mysql.user;
    5. grant privilege to your new user, be aware that this command grants pmauser as superuser as root have: GRANT ALL PRIVILEGES ON *.* TO 'pmauser'@'%';


  2. configure the phpmyadmin config to use the created user
    1. go to /etc/phpmyadmin
      1. cd /etc/phpmyadmin
    2. edit the config-db.php file
      1. sudo gedit config-db.php
      2. edit the user (pma/pmauser) and password as we created before
      3. save the file


  3. refresh the page and login





No comments:

Post a Comment