LoginSignup
0
0

More than 3 years have passed since last update.

phpMyAdmin で 「管理ユーザ(controluser)での接続に失敗」というエラーへの対策

Last updated at Posted at 2021-04-23

次のエラーが出た時の対策です。
phpmyadmin_error.png

mysqli_real_connect(): (HY000/1698): Access denied for user 'phpmyadmin'@'local
host'

設定ファイルに定義されている管理ユーザ(controluser)での接続に失敗しました。

Ubuntu 21.04 の Nginx で確認しました。

次の情報を使って、ユーザーとデータベースを作成します。

/etc/phpmyadmin/config-db.php
$dbuser='phpmyadmin';
$dbpass='secret';
$basepath='';
$dbname='phpmyadmin';
$dbserver='localhost';
$dbport='3306';
$dbtype='mysql';
# mysql -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 73
Server version: 10.5.9-MariaDB-1 Ubuntu 21.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create user 'phpmyadmin'@'localhost' identified by 'secret'; 
Query OK, 0 rows affected (0.036 sec)

MariaDB [(none)]> create schema phpmyadmin;
Query OK, 1 row affected (0.049 sec)

MariaDB [(none)]> grant all on phpmyadmin.* to 'phpmyadmin'@'localhost';
Query OK, 0 rows affected (0.038 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> exit
Bye

ユーザーとデータベースを作成後、phpMyAdmin にアクセスすると、次のメッセージが出ます。

 phpMyAdmin 環境保管領域が完全に設定されていないため、いくつかの拡張機能が無効に
なっています。理由についてはこちらをご覧ください。
代わりにデータベースの操作タブを使って設定することもできます。

次の SQL でテーブルを作成します。

/usr/share/phpmyadmin/sql/create_tables.sql

mysql -uphpmyadmin -psecret phpmyadmin < /usr/share/phpmyadmin/sql/create_tables.sql
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0