4

I've already read many threads on this issue but none of the answers worked for me. I try to access http://localhost/phpmyadmin but it gives me 403 Forbidden (You don't have permission to access /phpmyadmin on this server.). So I try to reconfigure phpmyadmin step by step:

sudo dpkg-reconfigure phpmyadmin
  1. reinstall database for phpmyadmin?

    yes

  2. Connection method for MySQL database of phpmyadmin:

    Unix socket

  3. MySQL database name for phpmyadmin:

    shopware_db

  4. MySQL username for phpmyadmin:

    phpmyadmin

  5. MySQL application password for phpmyadmin:

    [password chosen]

  6. Password confirmation:

    [same password]

  7. Name of the database's administrative user:

    root

  8. Web server to reconfigure automatically:

[*] apache2 [ ] lighttpd

  1. (only sometimes after choosing "retry" in the end) A new version (/tmp/dbconfig-package-config.vagoAL) of configuration file /etc/dbconfig-common/phpmyadmin.conf is available, but the version installed currently has been locally modified.

    keep the local version currently installed

10. An error occurred while installing the database: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

which is something I don't understand, because I can connect to mysql:

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 5.7.16-0ubuntu0.16.04.1 (Ubuntu)
...
mysql> use shopware_db
Database changed
mysql>

Note: The line Include /etc/phpmyadmin/apache.conf is included in /etc/apache2/apache2.conf

And here is my /etc/phpmyadmin/apache.conf (I've modified the first lines because that was suggested in one of these answers):

# phpMyAdmin default Apache configuration

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
    Options Indexes FollowSymLinks MultiViews
    DirectoryIndex index.php
    AllowOverride all
    Require all granted

    <IfModule mod_php.c>
        <IfModule mod_mime.c>
            AddType application/x-httpd-php .php
        </IfModule>
        <FilesMatch ".+\.php$">
            SetHandler application/x-httpd-php
        </FilesMatch>

        php_flag magic_quotes_gpc Off
        php_flag track_vars On
        php_flag register_globals Off
        php_admin_flag allow_url_fopen On
        php_value include_path .
        php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
        php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
    </IfModule>

</Directory>

# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
    <IfModule mod_authz_core.c>
        <IfModule mod_authn_file.c>
            AuthType Basic
            AuthName "phpMyAdmin Setup"
            AuthUserFile /etc/phpmyadmin/htpasswd.setup
        </IfModule>
        Require valid-user
    </IfModule>
</Directory>

# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/libraries>
    Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
    Require all denied
</Directory>

Edit:

When leaving Name of the database's administrative user (Step 7) at default (debian-sys-maint) no error occurs. But what user name is that? Where does it come from? Can't I change it to root?

And http://localhost/phpmyadmin is still not accessible.

1 Answer 1

1

The problem occurs when apache is not configured correctly. All I had to do was to edit /etc/apache2/sites-available/000-default.conf. Right after

DocumentRoot /var/www/html

add:

<Directory "/var/www/html">
    AllowOverride All
</Directory>

Also, as mentioned before, you have to set this line at the end of /etc/apache2/apache2.conf

Include /etc/phpmyadmin/apache.conf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .